This package provides tools to query the REST APIs of Scaleway.
The package is available on pip. To install it in a virtualenv:
virtualenv my_virtualenv
source my_virtualenv/bin/activate
pip install scaleway-sdkIf you're looking to send a GET HTTP request against our APIs, like:
GET <api_url>/foo/baryou only need to call the following pythonic code:
>>> from scaleway.apis import DummyAPI
>>> DummyAPI().query().foo.bar.get()The magic here lies in scaleway.apis.*API instances, which all have a
query method returning a slumber.API object. The latter handling all
the excruciating details of the requests.
Even if this SDK is designed to be developer-friendly and aim for self-service discovery, it is still recommended to read the official API documentation.
And because most of the provided helpers takes the form of pre-configured Slumber objects, a good read of Slumber documention is encouraged as well.
- List your organizations:
>>> from scaleway.apis import AccountAPI
>>> api = AccountAPI(auth_token='') # Set your token here!
>>> print api.query().organizations.get()
{u'organizations': [...]}- List your servers:
>>> from scaleway.apis import ComputeAPI
>>> api = ComputeAPI(auth_token='') # Set your token here!
>>> print api.query().servers.get()
{u'servers': [...]}- Get details of a server:
>>> from scaleway.apis import ComputeAPI
>>> api = ComputeAPI(auth_token='') # Set your token here!
>>> server_id = '' # Set a server ID here!
>>> print api.query().servers(server_id).get()
{u'server': {...}}- Check if your token has the permission
servers:readfor the servicecomputefor the organization9a096d36-6bf9-470f-91df-2398aa7361f7:
>>> from scaleway.apis import AccountAPI
>>> api = AccountAPI(auth_token='') # Set your token here!
>>> print api.has_perm(service='compute', name='servers:read',
... resource='9a096d36-6bf9-470f-91df-2398aa7361f7')
FalseAssuming you are in a virtualenv:
pip install -e .
python -c 'from scaleway.apis import AccountAPI'
# it works!To submit a patch, you'll need to test your code. To run tests:
pip install nose coverage pep8 pylint
python setup.py nosetests --with-coverage
# (...)
pep8 scaleway
# (...)
pylint scaleway
# (...)- coverage score should never be lower than before your patch.
- PEP8 should never return an error.
- pylint score should never be lower than before your patch.
- Ruby
- API client: https://github.com/bchatelard/onlinelabs-ruby
- Golang
- Go library + CLI: https://github.com/lalyos/onlabs (@lalyos)
- Vagrant packer + API client: https://github.com/meatballhat/packer-builder-onlinelabs/ (@meatballhat)
- Go CLI: https://github.com/nlamirault/go-scaleway (@nlamirault)
- Node.js/javascript
- Docker-like CLI: https://github.com/moul/scaleway-cli (@moul)
- Node.js + browser client: https://github.com/moul/node-scaleway (@moul)
- Cloudformation plugin, with API client: https://github.com/resin-io/onlinelabs-cloudformation (@resin.io)
- Python
- Juju plugin + with API client: https://github.com/online-labs/juju-onlinelabs
- API client: https://github.com/adebarbara/olpy (@adebarbara)
This software is licensed under a BSD 2-Clause License.