Giter Club home page Giter Club logo

py-smartdc's People

Contributors

atl avatar glassresistor avatar jcua avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

py-smartdc's Issues

Request error header

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 ?

Python Requests dropped config

kennethreitz/requests@4e5c4a6

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.

datacenter.me() method fails due to trailing '/'

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:
    

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.