Skip to main content

CloudShare API v3 SDK

Quickstart

pip install cloudshare

Then just import cloudshare and use the function cloudshare.req() described below.

Interface

This library is written for python 3.

def req(hostname, method, apiId, apiKey, path="", queryParams=None, content=None)

Required parameters are the hostname, method, apiId and apiKey.

hostname is usually use.cloudshare.com unless your using some mock or proxy.

method is one of "GET", "POST", "PUT", "DELETE", depends on the context of the call.

apiId and apiKey are valid CloudShare credentials.

path is what comes after the '/api/v3' part of the request url (e.g 'envs', 'vms/actions/executePath')

queryParams are a dict of values that translate to a query string and concatenated to the request url

content is a dict that's encoded to JSON and sent in the body section of the request, in POST and PUT requests.

Examples

example.py

Enter your credentials in the two global variables API_ID and API_KEY and run it with python example.py. The script tries to run the command echo hello world on the first machine on the first environment it finds (visible to the user's credentials).

List your environments

import cloudshare
res = cloudshare.req(hostname='use.cloudshare.com',
				method='GET',
				path='envs',
				apiId='Your API ID',
				apiKey='You API Key')
if (res.status / 100 != 2):
	raise Exception(res.status, res.content)
print 'hi! these are my environments:'
print [e['name'] for e in res.content]

Get one environment

import cloudshare
res = cloudshare.req(hostname='use.cloudshare.com',
				method='GET',
				path='envs/' + envId,
				apiId='Your API ID',
				apiKey='You API Key')
if (res.status / 100 != 2):
	raise Exception(res.status, res.content)
print 'look at my environment details:'
print res.content

Suspend an environment

import cloudshare
res = cloudshare.req(hostname='use.cloudshare.com',
				method='PUT',
				path='envs/actions/suspend',
				queryParams={'envId': envId},
				apiId='Your API ID',
				apiKey='Your API Key')
if (res.status / 100 != 2):
	raise Exception(res.content)
print res.content

Building from source

make setup
make build test

Let's Encrypt Certificates

You might need to install these root certificates if they were not updated by the OS

https://letsencrypt.org/certs/isrgrootx1.der

https://letsencrypt.org/certs/isrg-root-x2.der

https://letsencrypt.org/certs/lets-encrypt-r3.der

More info here:

https://letsencrypt.org/certificates/

Metadata

Release files for cloudshare 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cloudshare 0.1.3
File Size Uploaded Provenance Actions
cloudshare-0.1.3.tar.gz 10.6 kB Without provenance Details for cloudshare-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cloudshare 0.1.3
File Interpreter ABI Platform Actions
cloudshare-0.1.3-py2.py3-none-any.whl Python 2, Python 3 none any Details for cloudshare-0.1.3-py2.py3-none-any.whl

Total release size: 27.0 kB

Release files / cloudshare-0.1.3.tar.gz

Download URL cloudshare-0.1.3.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9af9deb80ee3f9fa0407313e00e05920909ca9aedf1d2f0217386f68514396af
BLAKE2b-256 checksum
How to use checksums
977900ec064387ede09e4e674e471da9798ad2ce99a4995a4792c6f26312157b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.6

Release files / cloudshare-0.1.3-py2.py3-none-any.whl

Download URL cloudshare-0.1.3-py2.py3-none-any.whl
Size 16.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
c234453204c84ec33d7c9a00434419b6a3aa698c56fadd051000ff8a7f1532cb
BLAKE2b-256 checksum
How to use checksums
52b59d530b06a79f702b5716d286916c062a9f96297df70e4aa2da5c27efcfa0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.6

Security for cloudshare 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page