kadirpekel / hammock Goto Github PK
View Code? Open in Web Editor NEWrest like a boss
Home Page: kadirpekel.github.com/hammock
rest like a boss
Home Page: kadirpekel.github.com/hammock
I haven't delved into the code, but there is a some kind of incompatibility with new requests.
Traceback (most recent call last):
File "/Users/prophet/projects/djangodash2013/gopython3/api/tests.py", line 34, in test_wrapper_parses_data_correct
data = self.api_wrapper.ask_about_package_info(name=self.package_name)
File "/Users/prophet/projects/djangodash2013/gopython3/api/abstract_wrappers.py", line 33, in make_request_with_kwargs
response = getattr(self.hammock, request_method)(**request_kwargs)
File "/Users/prophet/.envs/djangodash2013/lib/python3.3/site-packages/hammock.py", line 107, in aux
return hammock._request(method, *args, **kwargs)
File "/Users/prophet/.envs/djangodash2013/lib/python3.3/site-packages/hammock.py", line 100, in _request
return self._session.request(method, self._url(*args), **kwargs)
File "/Users/prophet/.envs/djangodash2013/lib/python3.3/site-packages/requests/sessions.py", line 330, in request
env_proxies = get_environ_proxies(url) or {}
File "/Users/prophet/.envs/djangodash2013/lib/python3.3/site-packages/requests/utils.py", line 419, in get_environ_proxies
if proxy_bypass(netloc):
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/urllib/request.py", line 2476, in proxy_bypass
return proxy_bypass_macosx_sysconf(host)
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/urllib/request.py", line 2460, in proxy_bypass_macosx_sysconf
return _proxy_bypass_macosx_sysconf(host, proxy_settings)
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/urllib/request.py", line 2434, in _proxy_bypass_macosx_sysconf
hostIP = ip2num(hostIP)
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/urllib/request.py", line 2413, in ip2num
parts = list(map(int, parts))
ValueError: invalid literal for int() with base 10: 'pypi'
It seems that redirects will change the HTTP verb used for a request, thus breaking RESTful interaction.
For example an app that redirects http to https will transform a myapi.fragment.POST()
to a myapi.fragment.GET()
This is discussed here: http://stackoverflow.com/questions/20475552/python-requests-library-redirect-new-url
Solution:
allow_redirects=False
)I've run into an endpoint with a hyphen (-) in it, which wraps api.website/end-point/?querystring=xxxx into website.end-point('?querystring=xxxx').GET() and I'm getting errors when I try to access it that way.
This character is completely valid in the REST documentation. I assume there are others, but this is the one that I came across. I didn't see anything that handles this type of case in the source.
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.