-
Notifications
You must be signed in to change notification settings - Fork 89
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 compatibility with ZAPI proxy mode in response handling #117
Fix compatibility with ZAPI proxy mode in response handling #117
Conversation
There's no exact equivalence of `X-Crawlera-Version` in ZAPI. The `Zyte-Request-Id` header seems to be the closest match yet it does not cover certain types of errors like authentication errors (e.g. `curl -v https://example.com/ -x $API_URL`). Thus `zyte-error-type` is introduced as well to also cover such scenarios.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #117 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 3 3
Lines 295 295
=========================================
Hits 295 295 ☔ View full report in Codecov by Sentry. |
@@ -93,25 +90,34 @@ def _assert_enabled(self, spider, | |||
crawler = self._mock_crawler(spider, settings) | |||
mw = self.mwcls.from_crawler(crawler) | |||
mw.open_spider(spider) | |||
httpproxy = HttpProxyMiddleware.from_crawler(crawler) |
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.
Most test changes are to apply this, i.e. run the Scrapy middleware not just the proxy middleware. They are not specifically needed for this change in the latest iteration, but I think it is best to keep the changes. They e.g. pointed to some bad proxy URLs (missing : after the API key).
There's no exact equivalence of
X-Crawlera-Version
in ZAPI. TheZyte-Request-Id
header seems to be the closest match yet it does not cover certain types of errors like authentication errors (e.g.curl -v https://example.com/ -x $API_URL
).Thus
zyte-error-type
is introduced as well to also cover such scenarios.