-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DRV-302: Introduce streaming api #165
Conversation
Working on fixing the CI. Will open a new PR shortly for that |
980f093
to
21967ae
Compare
I did a first pass and it looks good so far 👍 |
Current limitations: | ||
Python requests module uses HTTP1; hyper is used for HTTP/2 | ||
""" | ||
def __init__(self, client, expression, options): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use kwargs for options?
faunadb/client.py
Outdated
@@ -187,6 +189,31 @@ def query(self, expression, timeout_millis=None): | |||
""" | |||
return self._execute("POST", "", _wrap(expression), with_txn_time=True, query_timeout_ms=timeout_millis) | |||
|
|||
def stream(self, expression, options=None, on_start=None, on_error=None, on_version=None, on_history=None, blocking=True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use kwargs for options and event handlers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would lean more on not using kwargs since we have a finite and well defined set of possible events and names of event handlers. IMO it also improves readability and documentation.
110886e
to
d7734a8
Compare
8fbd64e
to
8f92ca9
Compare
8f92ca9
to
e76f188
Compare
e76f188
to
809911d
Compare
LGTM feature wise but my level in Python does not allow me to give a real approval. |
809911d
to
4752921
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Introduces the streaming api for the Python driver.
Notable changes and limitations.
blocking=False
to the FaunaClient stream method, the event loop will be started in a separate thread.ss -K dst 127.0.0.1 dport = 8443
with an active stream.