beigna / basic_http Goto Github PK
View Code? Open in Web Editor NEWA easy to use and clean HTTP client lib for Python
A easy to use and clean HTTP client lib for Python
BasicHttp._path uses str.replace to remove the scheme, however if the scheme (e.g. http) appears also in the hostname, the hostname is partially removed, and then the str.replace used to remove the hostname doesnt work
$ python -c "import basic_http; print(basic_http.BasicHttp('http://httpbin.org/').GET())"
{'status': 400, 'header': {'Date': 'Sat, 25 Apr 2015 08:36:48 GMT', 'Content-Length': '166', 'Content-Type': 'text/html', 'Connection': 'close', 'Server': 'nginx'}, 'body': '<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body bgcolor="white">\r\n<center><h1>400 Bad Request</h1></center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\n'}
$ python
Python 2.7.5 (default, Apr 10 2015, 08:09:05)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urlparse
>>> url = urlparse.urlparse('http://httpbin.org/')
>>> url.geturl().replace(url.scheme, '')
'://bin.org/'
>>> url.geturl().replace(url.scheme, '').replace(url.netloc, '')[3:]
'bin.org/'
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.