atl / py-smartdc Goto Github PK
View Code? Open in Web Editor NEWPython SmartDataCenter CloudAPI connector
Home Page: http://pythonhosted.org/smartdc/
License: MIT License
Python SmartDataCenter CloudAPI connector
Home Page: http://pythonhosted.org/smartdc/
License: MIT License
Hi,
Hope that your still maintaining the code. I have an issue.
When an instances is created using "sdc.create_machine" and for some reason it failed and 409 is returned based on documentation that could be due to number of issues but the real issue will appear in the body of response but "raise_for_status" will only return status_code. Am i missing something ?
File "/home/mike/python/py-smartdc/smartdc/datacenter.py", line 232, in request
verify=self.verify, *_kwargs)
File "/home/mike/.virtualenvs/av/local/lib/python2.7/site-packages/requests-1.0.3-py2.7.egg/requests/api.py", line 38, in request
return session.request(method=method, url=url, *_kwargs)
TypeError: request() got an unexpected keyword argument 'config'
Need to drop config or define the version of requests to use.
2014-01-26T16:43:08.933902 GET https://us-west-1.api.joyentcloud.com/my/
{"code":"ResourceNotFound","message":"/my/ does not exist"}
Traceback (most recent call last):
File "./joyent.py", line 15, in
id = sdc.me()['id']
File "/home/rcj/devel/source/joyent/working/smartdc/datacenter.py", line 349, in me
j, _ = self.request('GET', '')
File "/home/rcj/devel/source/joyent/working/smartdc/datacenter.py", line 251, in request
resp.raise_for_status()
File "/usr/lib/python2.7/dist-packages/requests/models.py", line 683, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found
There should not be a trailing '/' for the me() function. A simple fix is to strip the trailing '/' when the path is empty in the request function like this:
--- datacenter.py 2014-01-26 16:42:40.223213133 -0600
+++ datacenter.py.mod 2014-01-26 16:33:48.815219105 -0600
@@ -225,7 +225,10 @@
:Returns: tuple of decoded response body & Response
object
:raises: client (4xx) errors
"""
full_path = self.url + path
if (path == ''):
full_path = self.url.rstrip('/')
else:
full_path = self.url + path
request_headers = {}
request_headers.update(self.default_headers)
if headers:
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.