Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Calling a Streaming API using requests library in Python
import requests
url = ""
response = requests.get(
headers={"accept": "application/json"},
for chunk in response.iter_content(chunk_size=1024):
if chunk:
print(str(chunk, encoding="utf-8"), end="")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment