scaleway / python-scaleway Goto Github PK
View Code? Open in Web Editor NEW:snake: Python SDK to query Scaleway APIs.
Home Page: https://developer.scaleway.com
License: Other
:snake: Python SDK to query Scaleway APIs.
Home Page: https://developer.scaleway.com
License: Other
I think it would be great to have ability to send user_data(usually text that is interpreted as bash script) when creating a server via the API, https://github.com/scaleway/api.scaleway.com/blob/master/contents/server.md#create-a-new-server-post
This way, a scaleway customer can be able to specify things that they would like to run during the server creation.
This already exists in other cloud platforms, eg:
The ovh create server api has a parameter called userData that you can specify:: https://api.ovh.com/console/#/cloud/project/%7BserviceName%7D/instance#POST
The digitalocean API also takes a parameter called user_data, https://developers.digitalocean.com/documentation/v2/#create-a-new-droplet
This is very useful especially when you want to automate creation of servers that are different from each other but are based off the same image.
All examples in the readme only demonstrate the usage for GET requests. There is not a single example for other request types like POST. I needed to dig inside the docs of Slumber to find out how to do them. Including at least one example on how to create a new server or similar would save some time for a lot of people i guess.
Looks like we forgot to set the licence and add copyrights header in our files.
Trying to list the RDB instances but I have difficulties to specify the region. That -
Hyphen seems to be the problem, but I am not Python expert enough figure out how to escape is correctly.
api = API(base_url="https://api.scaleway.com", auth_token="yo")
api.make_requests_session()
instances = api.query().rdb.v1.regions.fr-par1.instances.get()
Traceback (most recent call last):
File "executeOrder.py", line 11, in <module>
instances = api.query().rdb.v1.regions.fr-par1.instances.get()
NameError: name 'par1' is not defined
I rename the golang client and update API : https://github.com/nlamirault/go-scaleway
Using following:
compute_api = ComputeAPI(auth_token=secret_key, region='pl-waw-1')
compute_api.query().servers.post({'project': org_id, "name": 'test', "commercial_type": "DEV1-M"})
Got:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/draven/.local/lib/python2.7/site-packages/slumber/__init__.py", line 167, in post
resp = self._request("POST", data=data, files=files, params=kwargs)
File "scaleway/scaleway/apis/__init__.py", line 87, in _request
return super(SlumberResource, self)._request(*args, **kwargs)
File "/home/draven/.local/lib/python2.7/site-packages/slumber/__init__.py", line 101, in _request
raise exception_class("Client Error %s: %s" % (resp.status_code, url), response=resp, content=resp.content)
slumber.exceptions.HttpClientError: Client Error 400: https://api-pl-waw.scaleway.com/instance/v1/zones/pl-waw-1/servers/
Since there is no documents about how to use POST / Create so based on other sample such as this I assume the above code is correct.
But Error 400 ?
The first example of the readme api.query().organizations.get()
fails with error 404:
{"message": "The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.", "type": "404"}
When a request returns an error the exception printed to the console is quite useless because it does not contain the message of the response. Just the error code. It would be more convenient if the message of result would be included in the Exception text.
I was wondering if this sdk is still maintained by the scaleway team.
It still has support for the non-working account.scaleway.com
part of the api and doesn't support the new endpoints (like https://api.scaleway.com/account/v2alpha1/ssh-keys
for managing ssh keys) that are supported in the scaleway go sdk.
Not entirely related to this specific sdk, but this part of the api doesn't seem to be documented anywhere.
Python 3 unittests are failing because of HTTPretty, which is not committed to support Python 3.
Should we replace HTTPretty by another package ?
With Python 2.x, you get the error message "requests.exceptions.SSLError: hostname 'api.scaleway.com' doesn't match '*.cloud.online.net'" if the some packages, required by python-requests
, aren't installed. This message is cryptic, and often misunderstood by the users who don't know what SNI is.
The packages required by python-requests
to handle SNI are:
To compile them you need (on Ubuntu) to run apt-get install python-dev libffi-dev libssl-dev
prior their installation.
There's a problem if you do the installation in a bad order. If you:
pip install scaleway-sdk
apt-get install python-dev libffi-dev libssl-dev
pip install scaleway-sdk
The packages won't be recompiled (and I don't really know why, I need to investigate).
If you're in this case, you need to pip uninstall -v pyasn1 ndg-httpsclient pyOpenSSL scaleway-sdk
after installing the dependencies, and before running pip install scaleway-sdk
.
Anyway, we need to:
Reading the following line:
self.assertTrue(self.api.perm_matches(None, 'object:*'))
I would assume the opposite,
can you clarify this case and maybe update the docstring?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.