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:
- Reference documentation
- Example projects
- Developers website (API documentation)
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
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.
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()
The project is coded with Python, so don't hesitate to take advantage of it.
- All types of a product are stored in the
scaleway.product.version
namespace. For instance, theImage
interface of Registry v1 can be accessed withscaleway.registry.v1.Image
.
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)
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.
We love feedback. Feel free to reach us on Scaleway Slack community, we are waiting for you on #opensource.