Skip to content

Commit 421ac90

Browse files
authored
Readme update about code examples when opening an issue
1 parent a09dba9 commit 421ac90

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,37 @@ async def main():
982982
asyncio.run(main())
983983
```
984984

985+
### Reproducible code example
986+
987+
When opening an issue please include a
988+
[Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example)
989+
that shows the reported behavior. In addition, please make the code as self-contained as possible
990+
so an active Scrapy project is not required and the spider can be executed directly from a file with
991+
[`scrapy runspider`](https://docs.scrapy.org/en/latest/topics/commands.html#std-command-runspider).
992+
This usually means including the relevant settings in the spider's
993+
[`custom_settings`](https://docs.scrapy.org/en/latest/topics/settings.html#settings-per-spider)
994+
attribute:
995+
996+
```python
997+
import scrapy
998+
999+
class ExampleSpider(scrapy.Spider):
1000+
name = "example"
1001+
custom_settings = {
1002+
"TWISTED_REACTOR": "twisted.internet.asyncioreactor.AsyncioSelectorReactor",
1003+
"DOWNLOAD_HANDLERS": {
1004+
"https": "scrapy_playwright.handler.ScrapyPlaywrightDownloadHandler",
1005+
"http": "scrapy_playwright.handler.ScrapyPlaywrightDownloadHandler",
1006+
},
1007+
}
1008+
1009+
def start_requests(self):
1010+
yield scrapy.Request(
1011+
url="https://example.org",
1012+
meta={"playwright": True},
1013+
)
1014+
```
1015+
9851016

9861017
## Frequently Asked Questions
9871018

0 commit comments

Comments
 (0)