3 ms·
Nice! I'm writing a Python API client at the moment - a couple of suggestions: 1. It's worth taking a look at DictShield https://github.com/j2labs/dictshield h
by alexatkeplar 15y ago
Nice! I'm writing a Python API client at the moment - a couple of suggestions:
1. It's worth taking a look at DictShield https://github.com/j2labs/dictshield https://github.com/j2labs/dictshield or Colander (https://pylonsproject.org/projects/colander/dev/ https://pylonsproject.org/projects/colander/dev/) as a way to formalise your API definition and minimize the amount of boilerplate you have to write. I'd recommend DictShield - the author j2labs is very active on HN and is a really approachable guy.
2. Related to 1 - the Requests library (http://pypi.python.org/pypi/requests http://pypi.python.org/pypi/requests) is higher level than urllib* - again using this should help you to reduce boilerplate...
Happy coding!
- wesleyzhao 15y ago1. Just followed on github :) looking forward to using in the future. 2. Nice! Did not realize it could be that easy. Though I do wonder, does it hurt code efficiency at all? Not that it matters much to me at this point.
- alexatkeplar 15y ago2. I don't think it impacts on performance - because it's basically just a user-friendly wrapper around urllib2