Skip to content
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

Fix typing issues for typed Scrapy. #131

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Fix typing issues for typed Scrapy. #131

wants to merge 6 commits into from

Conversation

wRAR
Copy link
Contributor

@wRAR wRAR commented Sep 21, 2023

No description provided.

@codecov
Copy link

codecov bot commented Sep 21, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.88%. Comparing base (b08c735) to head (a8fa49f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #131      +/-   ##
==========================================
+ Coverage   97.86%   97.88%   +0.01%     
==========================================
  Files          14       14              
  Lines        1590     1605      +15     
  Branches      294      294              
==========================================
+ Hits         1556     1571      +15     
  Misses         14       14              
  Partials       20       20              
Files with missing lines Coverage Δ
scrapy_zyte_api/_params.py 100.00% <100.00%> (ø)
scrapy_zyte_api/_request_fingerprinter.py 98.33% <100.00%> (ø)
scrapy_zyte_api/_session.py 100.00% <100.00%> (ø)
scrapy_zyte_api/addon.py 98.11% <100.00%> (+0.03%) ⬆️
scrapy_zyte_api/handler.py 94.94% <100.00%> (+0.14%) ⬆️
scrapy_zyte_api/providers.py 94.73% <100.00%> (+0.08%) ⬆️
scrapy_zyte_api/responses.py 96.00% <100.00%> (ø)

@@ -188,8 +192,8 @@ def _process_response(

if api_response.get("httpResponseHeaders") and api_response.get("httpResponseBody"):
response_cls = responsetypes.from_args(
headers=api_response["httpResponseHeaders"],
url=api_response["url"],
headers=cast(List[Dict[str, str]], api_response["httpResponseHeaders"]),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This produces an error which looks valid: api_response["httpResponseHeaders"] is a list of dicts with "name" and "value" keys while ResponseTypes.from_headers expects a Mapping[bytes, bytes] (not even strings).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We’ll need to address that.

@wRAR wRAR marked this pull request as draft September 26, 2023 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants