Make sure you have python and pip.
Go ahead and install python-saucerest
pip install python-saucerest
import saucelabs.saucerest as saucerest
sauce = saucerest.SauceRest(
username="sauce-username",
password="sauce-access-key",
)
print "\033[33mAccount details:\033[0m\n%s\n" % repr(sauce.account_details())
print "\033[33mAccount limits:\033[0m\n%s\n" % repr(sauce.account_limits())
print "\033[33mAccount activity:\033[0m\n%s\n" % repr(sauce.account_activity())
print "\033[33mAccount usage:\033[0m\n%s\n" % repr(sauce.account_usage())
print "\033[33mRan %s jobs\033[0m\n" % repr(len(sauce.list_jobs(full=False)))
print "\033[33mJob 1:\033[0m\n%s\n" % repr(sauce.show_job(sauce.list_jobs(full=False)[1]['id']))
print "\033[33mShow job 1:\033[0m\n%s\n" % repr(sauce.update_job(sauce.list_jobs(full=False)[1]['id'], {'name': 'updated_job'}))
print "\033[33mUpate job 1:\033[0m\n%s\n" % repr(sauce.show_job(sauce.list_jobs(full=False)[1]['id']))
print "\033[33mList tunnels:\033[0m\n%s\n" % repr(sauce.list_tunnels())
print "\033[33mSauce status:\033[0m\n%s\n" % repr(sauce.sauce_status())
print "\033[33m10 first Sauce browsers/os combinations:\033[0m\n%s\n" % repr([b for b in sauce.sauce_browsers()[:10]])
print "\033[33m10%s tests have been run at sauce.\033[0m\n\n" % repr(sauce.sauce_counter())
Rest | Node Wrapper |
GET /users/:username Access account details. |
account_details() |
GET /:username/limits Access account limits |
account_limits() |
GET /:username/activity Access current account activity. |
account_activity() |
GET /users/:username/usage Access historical account usage data. |
account_usage() |
GET /:username/jobs List all job Id's belonging to a given user. |
list_jobs(full=False) full: When true, forces full job information to be returned rather than just Id's. |
GET /:username/jobs/:id Show the full information for a job given its ID. |
show_job(id) |
PUT /:username/jobs/:id Changes a pre-existing job. |
update_job(id, data) |
PUT /:username/jobs/:id/stop Terminates a running job. |
stop_job(id, data) |
GET /:username/tunnels Retrieves all running tunnels for a given user. |
list_tunnels() |
GET /:username/tunnels/:id Show the full information for a tunnel given its ID. |
show_tunnel(id) |
DELETE /:username/tunnels/:id Shuts down a tunnel given its ID. |
delete_tunnel(id) |
GET /info/status Returns the current status of Sauce Labs' services. |
sauce_status() |
GET /info/browsers Returns an array of strings corresponding to all the browsers currently supported on Sauce Labs. |
sauce_browsers() |
GET /info/counter Returns the number of test executed so far on Sauce Labs. |
sauce_counter() |
POST /users/:id Create a new sub-account. |
create_subaccount(data) data (dict): Information about your new subaccount See saucerest docs for more information. |
POST /users/:id/subscription Update a sub-account Sauce Labs service plan. |
update_subaccount(sub, data) sub (str): Sub-account name data (dict): Plan information See saucerest docs for more information. |
DELETE /users/:id/subscription Unsubscribe a sub-account from it's Sauce Labs service plan. |
sub (str): Sub-account name unsubscribe_subaccount(sub) |
Check out the Sauce REST API for more information