Add AsyncIO support
See original GitHub issueSupport for asynchronous methods introduced in PEP 0492 and Python 3.5 allow relatively simple asynchronous querying, especially for things like HTTP requests with aiohttp
. It would be very useful to be able to use PRAW natively with coroutines.
Here is an example of using aiohttp
to query the Reddit API asynchronously.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:8
- Comments:9 (5 by maintainers)
Top Results From Across the Web
asyncio — Asynchronous I/O — Python 3.11.1 documentation
Hello World!: asyncio is a library to write concurrent code using the async/await syntax. asyncio is used as a foundation for multiple Python...
Read more >Async IO in Python: A Complete Walkthrough
This tutorial is built to help you answer that question, giving you a firmer grasp of Python's approach to async IO. Here's what...
Read more >Python Asyncio: The Complete Guide
The asyncio module in Python was added specifically to add support for non-blocking I/O with subprocesses (e.g. executing commands on the ...
Read more >Asynchronous I/O (asyncio) - SQLAlchemy 1.4 Documentation
Set non-SQL options for the connection which take effect during execution. This returns this AsyncConnection object with the new options added.
Read more >Python Asyncio Part 5 – Mixing Synchronous and ...
Sadly not all tasks are IO-bound and not all libraries support asyncio. ... instead it creates a future, then adds a callback to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It is relevant if you want to use PRAW with other modules relying on asyncio, like discord.py
Seeing this comment chain a little later than I had hoped to find it. @bboe I took a look at your example and comparing it to what I have implemented in my framework it doesn’t seem too far off, yet after letting my bot run for a couple of hours (days, maybe) it will crash due to PRAW blocking the event loop, I think. The error specifically would be:
I do have my bot on GitHub so maybe you could give it a quick look? The repository can be found here. It really does seem like I’ll need to give
asyncio
a shot if using PRAW doesn’t work.