pySMS Automation and Macro Tools for SMS
pySMS is a python build module for scripting automation of SMS for ZimmerBiomet. pySMS utilizes the Selenium webdriver to send commands and information to the site. pySMS comes with a prebuilt data set of paths to interact with the site!
Getting Started
Prerequisites
you will need the following modules to be installed before using pySMS:
Selenium
colorama
binascii
lxml
cssselect
xlrd
pythoncom
PyDrive
prettytable
To install these, simply use pip from the command line or pip install pySMS and run this code in python:
from pySMS.req import prereq
prereq.import_pkgs()
prereq.upgrade_pkgs()
the follow can be downloaded from the extenstions folder!
pyHook
psycopg2
To Install pyHook:
- download the correct wheel and run pip:
`pip install pyHook-1.5.1-cp35-none-win_amd64.whl`
To Install Pyscopg2
- download pyscopg2.exe and run
Installing
Download pySMS from pip:
pip install pySMS
or download the zip file, unzip it, and run setup.py:
python setup.py build
python setup.py install
To install the required modules, simply use pip from the command line or pip install pySMS and run this code in python:
from pySMS.req import prereq
prereq.import_pkgs()
prereq.upgrade_pkgs()
to verify pySMS is installed correctly:
from pySMS.req import verify
verify.report()
Cloning
If you are cloning this repository, make sure you clone to this directory **ONLY**:
- C:\Users\YOUR USER NAME\
A Simple Script
open python and type:
from pySMS import selenium as s
m = s.macros()
m.launch() After this you will be prompted for your login information
m.var() must be called immediatly after launch, this defines the variables
m.login() This will log you in
m.slay() closes SMS and chrome
Connecting to the IW (postgres)
If you want to pull data straight from the IW into python you can use the pgsql module for this!
The following code is required before you can start using the IW. This code creates a credentials file that is encrypted.
from pySMS.pgsql import cipher as c
c.build_cipher_file()
The following code will test the connection to postgres:
from pySMS.pgsql.postgres import Postgres
p = Postgres()
p.load_postgres_data() decrypts information stored in credntials file
p.test_connection() test connection to IW, will retry 5 times by default
The following example will query the enum table in the sms schema
from pySMS.pgsql.postgres import Postgres
query = 'SELECT * FROM sms.enum'
p = Postgres()
p.load_postgres_data()
p.establish_connection()
data = p.execute(query)
print(data)
Other Examples
Other examples of using pySMS are the scripts:
- mutation.py
- adjustments.py
How to build
Run the script buildProgram.py:
python buildProgram.py -b
This will automatically update the program on the google drive as well as packaged the
necessary extensions. i.e. Chromedriver, console.exe, and the resources folder.
Contact Me
For questions or help using this contact me at:
Ian.Doarnzimmerbiomet.com