• Stars
    star
    114
  • Rank 298,322 (Top 7 %)
  • Language
    Python
  • License
    Other
  • Created over 9 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🐍 Python SDK to query Scaleway APIs.

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.

More Repositories

1

scaleway-cli

Command Line Interface for Scaleway
Go
843
star
2

docker-machine-driver-scaleway

🐳 Scaleway driver for Docker Machine
Go
248
star
3

frontalization

Pytorch deep learning face frontalization model
Python
198
star
4

terraform-provider-scaleway

Terraform Scaleway provider
Go
178
star
5

postal-address

📯 Parse, normalize and render postal addresses.
Python
174
star
6

natasha

Natasha is a fast and scalable, DPDK powered, stateless NAT44 packet processor
C
125
star
7

image-tools

🔩 Scripts used to create Images on Scaleway - https://github.com/scaleway-community
Shell
117
star
8

kernel-tools

🐧 Kernels on Scaleway
Makefile
104
star
9

scaleway-sdk-go

Integrate Scaleway with your Go application
Go
103
star
10

ultraviolet

A monorepo Design System with React components.
TypeScript
100
star
11

netbox-netprod-importer

Poll data from network devices in production and import it into netbox
Roff
94
star
12

c14-cli

[EOL] 💻 Manage your C14 Online Cold Storage from Command Line
Go
89
star
13

docs-content

Scaleway Documentation contents
MDX
77
star
14

serverless-scaleway-functions

Plugin for Serverless Framework to allow users to deploy their serverless applications on Scaleway Functions
JavaScript
69
star
15

image-builder

📐 build server images on Scaleway
Dockerfile
66
star
16

scaleway-csi

Container Storage Interface (CSI) Driver for https://www.scaleway.com/block-storage/
Go
56
star
17

scaleway-cloud-controller-manager

Kubernetes Cloud Controller Manager for Scaleway
Go
52
star
18

initrd

🔧 Initrd builder with qemu nbd metadata for Scaleway boot (armhf + x86_64)
Shell
51
star
19

action-scw

Github action to install and use scaleway-cli
TypeScript
49
star
20

netbox2netshot

Inventory synchronization tool between Netbox and Netshot
Rust
43
star
21

serverless-examples

Example projects and patterns for use with Scaleway's serverless products
HCL
42
star
22

python-netboxapi

Python client API for Netbox
Python
30
star
23

scaleway-sdk-js

Integrate Scaleway with your JS application
TypeScript
28
star
24

cert-manager-webhook-scaleway

A Scaleway DNS ACME webhook for cert-manager
Go
27
star
25

taskor

Async queued task library for Go
Go
27
star
26

juju-scaleway

☁️ Scaleway driver for Juju
Python
26
star
27

prometheus-scw-sd

Prometheus Service Discovery for Scaleway
Go
25
star
28

scaleway-operator

Scaleway Operator for Kubernetes
Go
25
star
29

scaleway-sdk-python

Integrate Scaleway with your Python applications
Python
24
star
30

scaleway-lib

scaleway-lib is a set of NPM packages used at Scaleway
TypeScript
22
star
31

crossplane-provider-scaleway

Crossplane Scaleway Provider
Go
16
star
32

serverless-gateway

Serverless API Gateway running on Scaleway
Python
15
star
33

homebrew-scaleway

🍺 `brew tap scaleway/scaleway`
Ruby
11
star
34

packer-plugin-scaleway

Packer plugin for Scaleway Builder
Go
10
star
35

serverless-functions-python

Utilities for testing your Python functions for Scaleway Serverless Functions.
Python
9
star
36

scaleway-form

Build amazing forms with Scaleway-ui and React-final-form 🚀🚀
TypeScript
9
star
37

scaleway-ui-website

Open Source Component Library
TypeScript
8
star
38

scaleway-functions-runtimes

Runtimes for Scaleway Function As A Service Platform
Go
8
star
39

serverless-api-framework-python

Framework for writing serverless APIs in Python, using Scaleway functions and containers.
Python
8
star
40

ansible

Ansible Collection for Scaleway
Python
7
star
41

serverless-offline-scaleway

JavaScript
7
star
42

qa

💔 Cloud testing suite
Makefile
6
star
43

serverless-functions-node

Offline testing for Scaleway Serverless Functions
TypeScript
6
star
44

sentry-wrapper

Log exceptions of a non sentry-capable setuptools entrypoint to Sentry
Python
6
star
45

cq-source-scaleway

CloudQuery Provider for Scaleway
Go
5
star
46

python2-secrets

Backport python3.6 secrets to python2
Python
5
star
47

octodns-scaleway

Scaleway provider for octoDNS
Python
5
star
48

terraform-scaleway-vpc-module

Terraform module for configuring a VPC
HCL
5
star
49

action-scw-secret

TypeScript
5
star
50

port-range

🐍 A python module for port-range
Python
4
star
51

helm-charts

Scaleway Helm Charts
Mustache
4
star
52

waypoint-plugin-scaleway

Waypoint provider for Scaleway
Go
4
star
53

design-tokens

JSON design tokens used in Scaleway UI library
4
star
54

serverless-functions-go

Scaleway Serverless Functions (FaaS) framework to increase developer experience, local testing and more
Go
4
star
55

python-dkim

User-friendly interface as well as python bindings for libopendkim.
Python
3
star
56

kernels

Kernel repository used at Scaleway (branch-oriented)
3
star
57

learn-nomad-cluster-setup

Infrastructure configuration to deploy a Nomad cluster on Scaleway
Shell
2
star
58

scaleway-packages

Repository of the RPM packages used in Scaleway Instance Images
2
star
59

demo-scaleway-ansible-baremetal

Scaleday 2019 demo baremetal
Python
2
star
60

tim

TIM is a plugin for testinfra parametrizing tests as described by a yaml file.
Python
1
star
61

snippets

Snippets to use Scaleway services
Python
1
star
62

tutorial-tem-serverless-terraform

HTML
1
star
63

terraform-scaleway-lb-module

HCL
1
star