Skip to content

Commit 0724815

Browse files
committed
CI checks for examples
1 parent 61f1a10 commit 0724815

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

examples/books.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,18 @@ def parse(self, response: Response, current_page: Optional[int] = None) -> Gener
3333
)
3434

3535
async def parse_book(self, response: Response) -> dict:
36-
url_md5 = hashlib.md5(response.url.encode("utf-8")).hexdigest()
36+
url_sha256 = hashlib.sha256(response.url.encode("utf-8")).hexdigest()
3737
page = response.meta["playwright_page"]
3838
await page.screenshot(
39-
path=Path(__file__).parent / "books" / f"{url_md5}.png", full_page=True
39+
path=Path(__file__).parent / "books" / f"{url_sha256}.png", full_page=True
4040
)
4141
await page.close()
4242
return {
4343
"url": response.url,
4444
"title": response.css("h1::text").get(),
4545
"price": response.css("p.price_color::text").get(),
4646
"breadcrumbs": response.css(".breadcrumb a::text").getall(),
47-
"image": f"books/{url_md5}.png",
47+
"image": f"books/{url_sha256}.png",
4848
}
4949

5050

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ basepython = python3
2424
deps =
2525
bandit
2626
commands =
27-
bandit -r {posargs: scrapy_playwright setup.py}
27+
bandit -r {posargs: scrapy_playwright setup.py examples}
2828

2929
[testenv:black]
3030
basepython = python3.8
@@ -46,4 +46,4 @@ deps =
4646
mypy==0.790
4747
commands =
4848
mypy --show-error-codes --ignore-missing-imports \
49-
--follow-imports=skip {posargs: scrapy_playwright setup.py tests}
49+
--follow-imports=skip {posargs: scrapy_playwright setup.py tests examples}

0 commit comments

Comments
 (0)