cloudshare


Namecloudshare JSON
Version 0.1.3 PyPI version JSON
download
home_pagehttps://github.com/cloudshare/cloudshare-py-sdk
SummaryA python wrapper for the CloudShare REST API.
upload_time2023-01-09 10:27:11
maintainer
docs_urlNone
authorJonathan Sadan
requires_python>=3.6
license
keywords cloudshare cloud sdk rest api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            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/

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/cloudshare/cloudshare-py-sdk",
    "name": "cloudshare",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "cloudshare,cloud,SDK,REST,API",
    "author": "Jonathan Sadan",
    "author_email": "Jonathan Sadan <jonathan@cloudshare.com>",
    "download_url": "https://files.pythonhosted.org/packages/97/79/00ec064387ede09e4e674e471da9798ad2ce99a4995a4792c6f26312157b/cloudshare-0.1.3.tar.gz",
    "platform": null,
    "description": "CloudShare API v3 SDK\r\n=====================\r\nQuickstart\r\n----------\r\n`pip install cloudshare`\r\n\r\n\r\nThen just `import cloudshare` and use the function `cloudshare.req()` described below.\r\n\r\n\r\nInterface\r\n---------\r\nThis library is written for python 3.\r\n\r\n```\r\ndef req(hostname, method, apiId, apiKey, path=\"\", queryParams=None, content=None)\r\n```\r\nRequired parameters are the `hostname`, `method`, `apiId` and `apiKey`.\r\n\r\n`hostname` is usually `use.cloudshare.com` unless your using some mock or proxy.\r\n\r\n`method` is one of \"GET\", \"POST\", \"PUT\", \"DELETE\", depends on the context of the call.\r\n\r\n`apiId` and `apiKey` are valid CloudShare credentials.\r\n\r\n`path` is what comes after the `'/api/v3'` part of the request url (e.g `'envs'`, `'vms/actions/executePath'`)\r\n\r\n`queryParams` are a dict of values that translate to a query string and concatenated to the request url\r\n\r\n`content` is a dict that's encoded to JSON and sent in the body section of the request, in POST and PUT requests.\r\n\r\nExamples\r\n--------\r\n#### example.py\r\nEnter 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).\r\n\r\n#### List your environments\r\n```\r\nimport cloudshare\r\nres = cloudshare.req(hostname='use.cloudshare.com',\r\n\t\t\t\tmethod='GET',\r\n\t\t\t\tpath='envs',\r\n\t\t\t\tapiId='Your API ID',\r\n\t\t\t\tapiKey='You API Key')\r\nif (res.status / 100 != 2):\r\n\traise Exception(res.status, res.content)\r\nprint 'hi! these are my environments:'\r\nprint [e['name'] for e in res.content]\r\n```\r\n\r\n#### Get one environment\r\n```\r\nimport cloudshare\r\nres = cloudshare.req(hostname='use.cloudshare.com',\r\n\t\t\t\tmethod='GET',\r\n\t\t\t\tpath='envs/' + envId,\r\n\t\t\t\tapiId='Your API ID',\r\n\t\t\t\tapiKey='You API Key')\r\nif (res.status / 100 != 2):\r\n\traise Exception(res.status, res.content)\r\nprint 'look at my environment details:'\r\nprint res.content\r\n```\r\n\r\n#### Suspend an environment\r\n```\r\nimport cloudshare\r\nres = cloudshare.req(hostname='use.cloudshare.com',\r\n\t\t\t\tmethod='PUT',\r\n\t\t\t\tpath='envs/actions/suspend',\r\n\t\t\t\tqueryParams={'envId': envId},\r\n\t\t\t\tapiId='Your API ID',\r\n\t\t\t\tapiKey='Your API Key')\r\nif (res.status / 100 != 2):\r\n\traise Exception(res.content)\r\nprint res.content\r\n```\r\n\r\n## Building from source\r\n\r\n```\r\nmake setup\r\nmake build test\r\n```\r\n\r\n\r\n## Let's Encrypt Certificates\r\nYou might need to install these root certificates if they were not updated by the OS\r\n\r\nhttps://letsencrypt.org/certs/isrgrootx1.der\r\n\r\nhttps://letsencrypt.org/certs/isrg-root-x2.der\r\n\r\nhttps://letsencrypt.org/certs/lets-encrypt-r3.der\r\n\r\n\r\nMore info here:\r\n\r\nhttps://letsencrypt.org/certificates/\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A python wrapper for the CloudShare REST API.",
    "version": "0.1.3",
    "split_keywords": [
        "cloudshare",
        "cloud",
        "sdk",
        "rest",
        "api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "52b59d530b06a79f702b5716d286916c062a9f96297df70e4aa2da5c27efcfa0",
                "md5": "b027c518a3d3829f008f32f7a9b19e8e",
                "sha256": "c234453204c84ec33d7c9a00434419b6a3aa698c56fadd051000ff8a7f1532cb"
            },
            "downloads": -1,
            "filename": "cloudshare-0.1.3-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b027c518a3d3829f008f32f7a9b19e8e",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.6",
            "size": 16398,
            "upload_time": "2023-01-09T10:27:09",
            "upload_time_iso_8601": "2023-01-09T10:27:09.887368Z",
            "url": "https://files.pythonhosted.org/packages/52/b5/9d530b06a79f702b5716d286916c062a9f96297df70e4aa2da5c27efcfa0/cloudshare-0.1.3-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "977900ec064387ede09e4e674e471da9798ad2ce99a4995a4792c6f26312157b",
                "md5": "93652d462b9fe0b5590f6ca2d941cfcf",
                "sha256": "9af9deb80ee3f9fa0407313e00e05920909ca9aedf1d2f0217386f68514396af"
            },
            "downloads": -1,
            "filename": "cloudshare-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "93652d462b9fe0b5590f6ca2d941cfcf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 10602,
            "upload_time": "2023-01-09T10:27:11",
            "upload_time_iso_8601": "2023-01-09T10:27:11.023810Z",
            "url": "https://files.pythonhosted.org/packages/97/79/00ec064387ede09e4e674e471da9798ad2ce99a4995a4792c6f26312157b/cloudshare-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-09 10:27:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "cloudshare",
    "github_project": "cloudshare-py-sdk",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "cloudshare"
}
        
Elapsed time: 0.03147s