Skip to content

Monitob/scaleway-sdk-python

 
 

Repository files navigation

Scaleway Python SDK

This SDK enables you to interact with Scaleway APIs.

Warning The project is in beta, but should be fairly stable. If you have issues using it, please open an issue.

🔗  Important links:

Installation

This library was made using Python 3.8, it should work on the latest versions too.

The SDK is available in two flavors, a synchronous and an asynchronous one. Both have the same usage, only difference is that the asynchronous library has every methods set to async.

Synchronous:

pip install scaleway

Asynchronous:

pip install scaleway-async

Getting Started

You'll need a pair of access and secret keys to connect to Scaleway API. Please check the documentation on how to retrieve them.

For a simpler setup, you could retrieve the profile from the configuration file and the environment variables:

from scaleway import Client
from scaleway.registry.v1 import RegistryV1API

client = Client.from_config_file_and_env()

api = RegistryV1API(client)
print(api.list_namespaces())

Client.from_profile tries to load the configuration file and the environment variables. Environment variables take precedence over the configuration file but this feature is configurable.

For more advanced needs, please check the examples.

Pagination

We included some pagination helpers for the methods supporting the feature. Let's take list_namespaces() (Registry product) as an example:

Retrieve the first page:

result = api.list_namespaces(
    # page=1,
)

Retrieve all the pages:

namespaces = api.list_namespaces_all()

Types

The project is coded with Python, so don't hesitate to take advantage of it.

  1. All types of a product are stored in the scaleway.product.version namespace. For instance, the Image interface of Registry v1 can be accessed with scaleway.registry.v1.Image.

Logging

We are using the standard Python logging library. You can configure it as you wish.

import logging

logger = logging.getLogger("scaleway")
logger.addHandler(logging.StreamHandler())
logger.setLevel(logging.DEBUG)

Development

This repository is at its early stage and is still in active development. If you are looking for a way to contribute please read CONTRIBUTING.md.

Reach us

We love feedback. Feel free to reach us on Scaleway Slack community, we are waiting for you on #opensource.

About

Integrate Scaleway with your Python applications

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%