Single file alternative to python-requests
requests is an awesome Python library to make HTTP requests.
Unfortunately, pip install
-ing is difficult in a serverless environment such as AWS Lambda.
req
is a minimum(broken) port of requests
, written in single python file, and it has no dependency. It is incredibly easy to use, all you have to do is coping the file.
Copy req.py.
Very similar to requests
.
import req
res = req.get('http://httpbin.org/headers', headers={'Some': 'Header'})
print(res.json())
- Only
UTF-8
encoding is supported - No support for some arguments:
'cookies', 'files', 'auth', 'proxies', 'verify', 'stream', 'cert'
- No support for some properties of response
- Not tested well