Urllib3 is a HTTP client for python it can grab data, post data, stream data, work with JSON as well as use redirects.
Urllib3 can be installed using pip:
python -m pip install urllib3
or via GitHub:
git clone git://github.com/urllib3/urllib3.git
python setup.py install
code example:
cat test_urllib
#!/usr/bin/env python3
"""urllib3 module test"""
import urllib3
http = urllib3.PoolManager()
URL = 'http://dub-ne.blogspot.com'
resp = http.request('GET', URL)
print(resp.status)
python test_urllib
200
- code 200 ("OK") indicates that the request has succeeded.
HTTP response code groups:
- Informational responses (100–199)
- Successful responses (200–299)
- Redirects (300–399)
- Client errors (400–499)
- Server errors (500–599)
Urllib3 features:
- Thread safety.
- Connection pooling.
- Client-side SSL/TLS verification.
- File uploads with multipart encoding.
- Helpers for retrying requests and dealing with HTTP redirects.
- Support for gzip, deflate, and brotli encoding.
- Proxy support for HTTP and SOCKS.
- 100% test coverage.
No comments:
Post a Comment