Skip to content

Instantly share code, notes, and snippets.

@janlukasschroeder
Last active August 21, 2021 10:22
Show Gist options
  • Save janlukasschroeder/729dc58b0810926a10edf73d9c688ea2 to your computer and use it in GitHub Desktop.
Save janlukasschroeder/729dc58b0810926a10edf73d9c688ea2 to your computer and use it in GitHub Desktop.
SEC EDGAR Streaming Client - Python
import socketio
sio = socketio.Client()
@sio.on('connect', namespace='/all-filings')
def on_connect():
print("Connected to https://api.sec-api.io:3334/all-filings")
@sio.on('filing', namespace='/all-filings')
def on_filings(filing):
print(filing)
sio.connect('https://api.sec-api.io:3334?apiKey=YOUR_API_KEY', namespaces=['/all-filings'], transports=["websocket"])
sio.wait()
@dokebivc
Copy link

dokebivc commented May 2, 2021

Hello I have socketio.exceptions.ConnectionError: OPEN packet not returned by server, and I cannot solve this problem
I just copy & paste, and them only modify apiKey to mine, Is there any regulation to operate this program? like operating time of server or OS or Socketio version?

@janlukasschroeder
Copy link
Author

@dokebivc try using socket.io version 2 instead of version 3. that should solve the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment