2019-07-08 08:01:12 +00:00
|
|
|
# StreamedRequests
|
|
|
|
|
|
|
|
[![Build Status](https://travis-ci.org/beardog108/StreamedRequests.svg?branch=master)](https://travis-ci.org/beardog108/StreamedRequests)
|
|
|
|
|
2019-07-04 08:30:09 +00:00
|
|
|
Python module to stream HTTP requests in order to ensure content length sanity.
|
2019-07-08 08:01:12 +00:00
|
|
|
|
2020-04-06 08:21:04 +00:00
|
|
|
# Install
|
|
|
|
|
|
|
|
`$ pip install StreamedRequests`
|
|
|
|
|
|
|
|
# Basic Usage
|
|
|
|
|
|
|
|
```
|
|
|
|
from streamedrequests import get, post
|
|
|
|
|
|
|
|
def my_func(data):
|
|
|
|
# prints every 5 bytes of data from site
|
|
|
|
print(data)
|
|
|
|
|
|
|
|
get('https://example.com/', callback=my_func, chunk_size=5)
|
|
|
|
```
|
|
|
|
|
|
|
|
sync: bool (default True) when set to false creates and starts a new thread for streaming
|
|
|
|
|
|
|
|
request_headers param can be used to set req headers
|
|
|
|
|
|
|
|
post() is the same, but use post_data to set request body.
|
|
|
|
|
|
|
|
|
2019-07-08 08:01:12 +00:00
|
|
|
# Contact
|
|
|
|
|
|
|
|
https://chaoswebs.net/
|