Package: scaleway-sdk
Python SDK to queryScaleway’sAPIs.Stable release:Development:InstallationThe package is available onpip. To install it in a virtualenv:$virtualenvmy_virtualenv$sourcemy_virtualenv/bin/activate$pipinstallscaleway-sdkGeneral principleIf you’re looking to send aGETHTTP request against our APIs, like:GET <api_url>/foo/baryou only need to call the following pythonic code:>>>fromscaleway.apisimportDummyAPI>>>DummyAPI().query().foo.bar.get()The magic here lies inscaleway.apis.*APIinstances, which all have aquerymethod returning aslumber.APIobject. The latter handling all
the excruciating details of the requests.DocumentationEven if this SDK is designed to be developer-friendly and aim for self-service
discovery, it is still recommended to read the officialAPI documentation.And because most of the provided helpers takes the form of pre-configuredSlumberobjects, a good read ofSlumberdocumention 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)ExamplesList your organizations:>>>fromscaleway.apisimportAccountAPI>>>api=AccountAPI(auth_token='')# Set your token here!>>>printapi.query().organizations.get(){u'organizations':[...]}List your organizations, but get aflask.Responseobject instead of adict:>>>fromscaleway.apisimportAccountAPI>>>api=AccountAPI(auth_token='')# Set your token here!>>>resp=api.query(serialize=False).organizations.get()>>>printtype(resp)<Response[200]>>>>printresp.headers{...}# Response HTTP headers.>>>printresp.links{...}# Parsed "Link" HTTP header, for pagination.>>>printresp.json(){u'organizations':[...]}List your servers:>>>fromscaleway.apisimportComputeAPI>>>api=ComputeAPI(auth_token='')# Set your token here!>>>printapi.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!>>>printapi.query().servers.get(){u'servers':[...]}Get details of a server:>>>fromscaleway.apisimportComputeAPI>>>api=ComputeAPI(auth_token='')# Set your token here!>>>server_id=''# Set a server ID here!>>>printapi.query().servers(server_id).get(){u'server':{...}}Check if your token has the permissionservers:readfor the servicecomputefor the organization9a096d36-6bf9-470f-91df-2398aa7361f7:>>>fromscaleway.apisimportAccountAPI>>>api=AccountAPI(auth_token='')# Set your token here!>>>printapi.has_perm(service='compute',name='servers:read',...resource='9a096d36-6bf9-470f-91df-2398aa7361f7')FalseDevelopmentAssuming you are in avirtualenv:$pipinstall-e.$python-c'from scaleway.apis import AccountAPI'# it works!TestTo submit a patch, you’ll need to test your code against python2.7 and
python3.4. To run tests:$pipinstallnosecoveragepycodestylepylint$pythonsetup.pynosetests--with-coverage(...)$pycodestylescaleway(...)$pylintscaleway(...)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 runnosetestson both Python2.7 and Python3.4, you can runtox.Alternative libraries / clientsWe maintain a list of the current library/client implementations on theapi.scaleway.com repository.LicenseThis software is licensed under aBSD 2-Clause License.Changes for v1.15.0 (2023-05-12)Add nl-ams-3 AZFull changelog.