Git Product home page Git Product logo

python-sdk's People

Contributors

abhijeet-wadkar avatar abrutus avatar aroundthesea avatar camerona93 avatar ellardli avatar gentlecat avatar kromped avatar leblanc avatar lukmdo avatar naissa12 avatar thef1rstpancake avatar zedshaw 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

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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-sdk's Issues

PyPI deployment

It'd be nice to have this on PyPI just to simplify installation, esp for automated deployments.

Key Error response['access_token'] before message handled

Oauth2: using the getToken method, basically following this tutorial: https://www.wepay.com/developer/overview/build-a-crowdfunding-site

Okay weird title, but hopefully this will help break it down...

I was (stupidly) using an incorrect client ID/secret, and when wepay/api.py, in the get_token function was returning, I was getting a key error on line 126, where it checks to set the self.access_token.

What I'm finding, is that, if there's an error returned by the previous line (self.call), it will not do anything with that error because the code will error out on the response['access_token'] because 'access_token' won't be set when the code errors out.

Here are a couple screenshots because I'm not great at explaining: http://imgur.com/a/oKcnJ/all

Swapping that line to: self.access_token = response.get('access_token', None)
clears the keyerror, but doesn't do much in terms of helping you know wthat there's a problem. BUT the error is at least there in the response.

So.. yeah. Just some thoughts. I can make a PR for that if you want, or you can just try it out and test it ourself.

local variable 'response' referenced before assignment

The exception handling in api.py lines 68..75 contains a potential error, if the post throws an exception then 'response' in the except will be undefined. This results in the following error.

local variable 'response' referenced before assignment

When reconciling we noticed these errors during the 3/14 maintenance window.

This does not really affect the function (it has failed either way) but the error reported is confusing.

Also this should probably always throw an exception regardless of the status_code.

    try:
        response = self.requests.post(
            url, data=params, headers=headers,
            timeout=self.request_timeout)
        return response.json()
    except:
        if 400 <= response.status_code <= 599:
            raise Exception('Unknown error. Please contact [email protected]')

Cannot parse json

in call function if param is None it should stay None instead of json encoding an empty dictionary.
Example is '/user' API call doesn't require any arguments, and therefore gives an Exception.

Select a license

This definitely needs a license with it before too many begin to use the module.

Should not catch all exceptions

except:

In the event of some other errors, the exception is just swallowed. For example, a network error. You should list the exceptions that you want to catch.

And I think the code expects that an exception will be raised if the status code is 4xx/5xx, but, as far as I know, it's not the case.

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.