do automate things on Linux
Project description
auto_everything
Linux system automation
Installation
wget https://github.com/yingshaoxo/auto_everything/raw/master/env_setup.sh
sudo bash env_setup.sh
Magic
wget https://github.com/yingshaoxo/auto_everything/raw/master/demo/install_YouCompleteMe.py
sudo python3 install_YouCompleteMe.py
Basic API
Import
from auto_everything.base import Terminal
t = Terminal()
Run a command & get reply
reply = t.run_command('uname -a')
print(reply)
Run commands & wait until it was finished
commands = """
sudo apt update
uname -a
"""
t.run(commands, wait=True)
Run a program
t.run_program('firefox')
Run a python script
t.run_py('your_python_file_path')
Run a bash script
t.run_sh('your_.sh_file_path')
Detect if a program or script is running
status = t.is_running('terminal')
print(status)
Kill it
t.kill('terminal')
Advanced API
Keep a function running
from auto_everything.base import Python
py = Python()
i = 0
@py.loop(thread=False)
def count():
global i
i += 1
print(i)
count()
print("Welcome to my world!")
Create(start) or Cancel(stop) a systemd serviece
from auto_everything.base import Super
s = Super(username="root")
s.service("service_name", "your_python_file_path")
Package management
Install or Uninstall a Python package
from auto_everything.base import Python
py = Python()
py.install_package("any_package_name")
py.uninstall_package("any_package_name")
Install or Uninstall a Lubuntu package
from auto_everything.base import Terminal
t = Terminal()
t.install_package("any_package_name")
t.uninstall_package("any_package_name")
Anothers
Web automation
from auto_everything.web import Selenium
from time import sleep
my_selenium = Selenium("https://www.google.com", headless=False)
d = my_selenium.driver
# get input box
xpath = '//*[@id="lst-ib"]'
element = my_selenium.wait_until_exists(xpath)[0]
# text inputing
element.send_keys('\b' * 20, "yingshaoxo")
# click search button
element = my_selenium.wait_until_exists('//input[@value="Google Search"]')[0]
element.click() # d.execute_script("arguments[0].click();", element)
# exit
sleep(30)
d.quit()
Simpler IO
from auto_everything.base import IO
io = IO()
io.write("hi.txt", "Hello, world!")
print(io.read("hi.txt"))
io.append("hi.txt", "\n\nI'm yingshaoxo.")
print(io.read("hi.txt"))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
auto_everything-2.3.tar.gz
(9.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file auto_everything-2.3.tar.gz.
File metadata
- Download URL: auto_everything-2.3.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8553643a48c9489479d01134587c482c4275f4a3d8c4b4a80b419c6cf9347e2
|
|
| MD5 |
dffbb25aa4884eca44aad01bd03c487a
|
|
| BLAKE2b-256 |
9fbe9a14ff30b1eb61ed7f4efd5a2941282afa0091f4b06fa4c3ed1f17b0ce32
|
File details
Details for the file auto_everything-2.3-py3-none-any.whl.
File metadata
- Download URL: auto_everything-2.3-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ac2c15f31d8c5e72e5a052fb84f3fb2570f61170257c879dc35348ce1188abb
|
|
| MD5 |
3d321059f5b89d166b30476f63c0ef00
|
|
| BLAKE2b-256 |
56898031c2885710ed1566a6c63bf0b3fef0582938cfed0656ea295e3ef4aed4
|