-
Notifications
You must be signed in to change notification settings - Fork 19
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #131 +/- ##
==========================================
+ Coverage 97.85% 97.87% +0.02%
==========================================
Files 14 14
Lines 1585 1603 +18
Branches 293 294 +1
==========================================
+ Hits 1551 1569 +18
Misses 14 14
Partials 20 20
|
scrapy_zyte_api/responses.py
Outdated
@@ -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"]), |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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.
Scrapy < 2.1 has a hidden bug, accidentally fixed in scrapy/scrapy#4481: |
OTOH I think this breakage will also happen in user code. Unless we want to drop Scrapy 2.0.1, we need to use |
No description provided.