Giter Site home page Giter Site logo

scaleway / python-scaleway Goto Github PK

View Code? Open in Web Editor NEW
113.0 113.0 27.0 281 KB

:snake: Python SDK to query Scaleway APIs.

Home Page: https://developer.scaleway.com

License: Other

Python 100.00%
api-client cloud-computing cloud-management cloud-storage iaas python scaleway sdk

python-scaleway's People

Contributors

abarbare avatar aerialls avatar bdronneau avatar brmzkw avatar cedriccabessa avatar depado avatar evasdk avatar frivoire avatar jerome-quere avatar karibou avatar kdeldycke avatar lodow avatar moul avatar oursin avatar quantumsheep avatar remyleone avatar traex avatar vikbez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-scaleway's Issues

add user_data parameter in create server API

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.

Documentation for other request types than GET missing

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.

Missing license

Looks like we forgot to set the licence and add copyrights header in our files.

Not able to specify region because of the Hyphen

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

Create server raise Client Error 400?

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 ?

404 Error on retrieving organizations

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"}

Exception text not useful

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.

Is this sdk still maintained

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.

Add explicit error message if SNI fails

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:

  • pyasn1
  • ndg-httpsclient
  • pyOpenSSL

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:

  • run pip install scaleway-sdk
  • something doesn't work, because you don't have the required packages, so you apt-get install python-dev libffi-dev libssl-dev
  • then you try to re-run 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:

  • add an explicit message if requests.exceptions.SSLError is raised
  • see why the Python packages required to handle SNI aren't reinstalled when you're trying to install sdk, install the dependencies and reinstall the sdk.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.