Document async def interfaces for signals
See original GitHub issueIt’d be nice to mention async def
approach in https://docs.scrapy.org/en/latest/topics/signals.html#deferred-signal-handlers, and maybe even rewrite the example to it.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
signal — Set handlers for asynchronous events ... - Python Docs
Source code: Lib/signal.py This module provides mechanisms to use signal handlers in Python. General rules: The signal.signal() function allows defining ...
Read more >asyncdbus - PyPI
The Client Interface To use a service on the bus, the library constructs a proxy object you can use to call methods, get...
Read more >Signals (System Interface Guide)
Signals can be synchronously generated by an error in an application, such as SIGFPE and SIGSEGV, but most signals are asynchronous.
Read more >Asyncio API — python-sdbus documentation - Read the Docs
Signal when existing object or and interface of existing object is removed. Signal data is: Object pathstr. Path to object that was removed...
Read more >Asynchronous and non-Blocking I/O - Tornado Web Server
Callback registry (e.g. POSIX signals). Regardless of which type of interface is used, asynchronous functions by definition interact differently with their ...
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
No results found
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
@codeslash21 Sure.
Scrapy uses Twisted, which has a class called Deferred, which is used to implement asynchronous code. You may find more information about them in the Twisted documentation, but it’s a complex topic, and full understanding is not needed for this task, I think.
However, Twisted also allows to write code using Python coroutines, also known as
async def
syntax. The code still uses deferreds underneath, but its use is transparent to users, and the resulting code is more readable.We actually have this covered in the documentation of Scrapy, at https://docs.scrapy.org/en/latest/topics/coroutines.html, with a good example of how a piece of code looks with Deferreds, and how the same code can be rewritten with coroutine syntax.
If you manage to understand that example, I think you should be able to handle this task, which would consist of:
Can I take this issue please ? I have been working on this one for almost a day now, trying to learn my way around coroutines and deferred objects.