koalalorenzo/python-digitalocean

Make droplet.create() return a value - so it can be used with 'await' ?

danryu opened this issue · 1 comments

Currently droplet.create() wraps a synchronous POST request to the API (calls get_data())

data = self.get_data("droplets/", type=POST, params=data)

Could create() be refactored to return a meaningful value?
This would mean it can be used with 'await' to allow asynchronous operation, eg
await droplet.create()

Otherwise you see this:
TypeError: object NoneType can't be used in 'await' expression

Don't think this is necessary.
FWIW I am using this in async lib gevent with Celery.