Skip to main content

Scaleway SDK

Python SDK to query Scaleway’s APIs.

Stable release: Last release Python versions Software license

Development: Unit-tests status Coverage Status Code Quality

Installation

The package is available on pip. To install it in a virtualenv:

$ virtualenv my_virtualenv
$ source my_virtualenv/bin/activate
$ pip install scaleway-sdk

General principle

If you’re looking to send a GET HTTP request against our APIs, like:

GET <api_url>/foo/bar

you 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.

Documentation

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.

The list of available resources per API can be found [on the Scaleway API repository](https://github.com/scaleway/api.scaleway.com/blob/master/README.md#apis)

Examples

  • 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 organizations, but get a flask.Response object instead of a dict:

>>> from scaleway.apis import AccountAPI
>>> api = AccountAPI(auth_token='')  # Set your token here!
>>> resp = api.query(serialize=False).organizations.get()
>>> print type(resp)
<Response [200]>
>>> print resp.headers
{...}  # Response HTTP headers.
>>> print resp.links
{...}  # Parsed "Link" HTTP header, for pagination.
>>> print resp.json()
{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': [...]}
# Or choose your region, as in apis/api_compute.py
>>> api = ComputeAPI(region='ams1', 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:read for the service compute for the organization 9a096d36-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')
False

Development

Assuming you are in a virtualenv:

$ pip install -e .
$ python -c 'from scaleway.apis import AccountAPI'
  # it works!

Test

To submit a patch, you’ll need to test your code against python2.7 and python3.4. To run tests:

$ pip install nose coverage pycodestyle pylint
$ python setup.py nosetests --with-coverage
  (...)
$ pycodestyle 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.

Alternatively, to run nosetests on both Python2.7 and Python3.4, you can run tox.

Alternative libraries / clients

We maintain a list of the current library/client implementations on the api.scaleway.com repository.

License

This software is licensed under a BSD 2-Clause License.

Changes for v1.15.0 (2023-05-12)

  • Add nl-ams-3 AZ

Full changelog.

Metadata

Release files for scaleway-sdk 1.15.0

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

Source distribution (sdist)

Source distribution for scaleway-sdk 1.15.0
File Size Uploaded
scaleway-sdk-1.15.0.tar.gz 19.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for scaleway-sdk 1.15.0
File Interpreter ABI Platform
scaleway_sdk-1.15.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 37.5 kB

Release files / scaleway-sdk-1.15.0.tar.gz

Download URL scaleway-sdk-1.15.0.tar.gz
Size 19.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8e3762b24c7dfbbf46ff7c4c9f57de3c17791df254f818608e29363b5ecd4fb7
BLAKE2b-256 checksum
How to use checksums
8bd72e5dd282a9d295db66b8a5b00c1072ec14291d63eef44c70c8aa0ace404a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release files / scaleway_sdk-1.15.0-py2.py3-none-any.whl

Download URL scaleway_sdk-1.15.0-py2.py3-none-any.whl
Size 18.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
bcaf446b00a6cb300c4e07062b601a5385fda4ef3c33d522c778ea9a32032ef1
BLAKE2b-256 checksum
How to use checksums
957f9cef9b35641bd124072b556d5e8d0a89795ad70105f1f281210118fd3380
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release history Release notifications | RSS feed

This release

1.15.0 This release

2 release files

1.12.0

3 release files

1.10.1

3 release files

1.10.0

3 release files

1.9.1

3 release files

1.9.0

3 release files

1.8.1

3 release files

1.8.0

3 release files

1.7.0

3 release files

1.6.0

3 release files

1.5.0

3 release files

1.4.1

3 release files

1.4.0

3 release files

1.3.0

3 release files

1.2.0

3 release files

1.1.4

3 release files

1.1.3

3 release files

1.1.2

3 release files

1.1.1

3 release files

1.1.0

3 release files

1.0.2

3 release files

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