-
-
Save yacineali74/e52ab7322586930c4ae6ad793c835dd2 to your computer and use it in GitHub Desktop.
Revisions
-
AIAnytime created this gist
Apr 15, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ import requests # Base endpoint base_url = "https://r.jina.ai/" # Input URL to be appended input_url = "https://www.stateof.ai/" # Full URL with the input URL appended after a plus (+) sign full_url = base_url + input_url # Headers to include in the request headers = { "Accept": "text/event-stream" } # Make the request with streaming enabled response = requests.get(full_url, headers=headers, stream=True) # Handle the streaming response try: for line in response.iter_lines(): if line: decoded_line = line.decode('utf-8') print(decoded_line) finally: response.close()