Last active
September 3, 2024 16:14
-
-
Save phith0n/4924a9d3258bc9cd604c52692809e943 to your computer and use it in GitHub Desktop.
CoNote client example
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 characters
import requests | |
import sseclient | |
url = 'https://note.leavesongs.com/api/events' | |
headers = {'Accept': 'text/event-stream', 'Authorization': 'Token <your API token>'} | |
response = requests.get(url, headers=headers, stream=True) | |
client = sseclient.SSEClient(response) | |
for event in client.events(): | |
print("New %s event: %s" % (event.event, event.data)) |
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 characters
requests | |
sseclient-py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment