-
-
Notifications
You must be signed in to change notification settings - Fork 84
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
JSON-RPC python client #3734
JSON-RPC python client #3734
Conversation
eecfab2
to
17f3094
Compare
17f3094
to
0577dfe
Compare
83dc816
to
d6b93d0
Compare
0d661e8
to
322d765
Compare
322d765
to
c001b9e
Compare
c001b9e
to
7b9dfee
Compare
I think it is sufficiently good for review and merge, we have a nice echo bot that uses only object-oriented API in |
0582cca
to
cc57387
Compare
cc57387
to
9b04a04
Compare
fresh_message_snapshots = await asyncio.gather(*fresh_message_snapshot_tasks) | ||
for snapshot in reversed(fresh_message_snapshots): | ||
if not snapshot.is_info: | ||
await snapshot.chat.send_text(snapshot.text) |
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.
will this never raise exception? example if bot was removed from group then get message due to email races, then message will never be marked as read and will be stuck failing always with that message
|
||
while True: | ||
event = await account.wait_for_event() | ||
if event["type"] == "Info": |
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.
would be nice to provide an StringEnum EventType
in the lib so user can compare with EventType.INFO instead of having to know the exact name of the event types
I created #3790 fixing some bugs and implementing some of my comments here |
Are you writing this for deltachat-bot/bot-pages#45 ? Because the python example in this PR is still kind of complicated, and now you have to know async... which is not the kind of simplicity I was aiming for in deltachat-bot/bot-pages#45. It does look pretty cool though and makes sense on its own, I think :) But maybe deltachat-bot/bot-pages#45 should not wait for this PR? |
No, see the full comment here: deltachat-bot/bot-pages#45 (comment) |
Rpc now has a start() method. This way it is possible to use Rpc from IPython without calling __aenter__()
def __getattr__(self, attr: str): | ||
async def method(*args, **kwargs) -> Any: | ||
self.id += 1 | ||
request_id = self.id | ||
|
||
assert not (args and kwargs), "Mixing positional and keyword arguments" |
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 guess it ok for now to do this dynamically. But for documentation purposes and for autocompletion it would be much nicer if there are spelled out methods with paramters and docstrings.
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.
nicely done. I'd prefer there to be more tests for the Message, Chat and Contact objects than there are now. What is also missing is documentation. But i guess none of this needs to block things right now.
Moved here from #3695