@@ -239,7 +239,7 @@ def _translate_headers(self, request, targets_zyte_api):
239239 continue
240240 request .headers [translation ] = value = request .headers .pop (header )
241241 logger .warning (
242- "Translating (and dropping) header %r (%r) as %r on request %r" ,
242+ "Translating header %r (%r) to %r on request %r" ,
243243 header ,
244244 value ,
245245 translation ,
@@ -371,8 +371,8 @@ def process_response(self, request, response, spider):
371371 "retries/auth/max_reached" , targets_zyte_api = targets_zyte_api
372372 )
373373 logger .warning (
374- "Max retries for authentication issues reached, please check auth "
375- " information settings" ,
374+ "Max retries for authentication issues reached,"
375+ "please check auth information settings" ,
376376 extra = {"spider" : self .spider },
377377 )
378378
@@ -392,7 +392,8 @@ def process_response(self, request, response, spider):
392392 self ._inc_stat ("response/banned" , targets_zyte_api = targets_zyte_api )
393393 else :
394394 self ._bans [key ] = 0
395- # If placed behind `RedirectMiddleware`, it would not count 3xx responses
395+ # If placed behind `RedirectMiddleware`,
396+ # it would not count 3xx responses
396397 self ._inc_stat ("response" , targets_zyte_api = targets_zyte_api )
397398 self ._inc_stat (
398399 "response/status/{}" .format (response .status ),
@@ -402,7 +403,8 @@ def process_response(self, request, response, spider):
402403 self ._inc_stat ("response/error" , targets_zyte_api = targets_zyte_api )
403404 error_msg = zyte_smartproxy_error .decode ("utf8" )
404405 self ._inc_stat (
405- "response/error/{}" .format (error_msg ), targets_zyte_api = targets_zyte_api
406+ "response/error/{}" .format (error_msg ),
407+ targets_zyte_api = targets_zyte_api ,
406408 )
407409 return response
408410
@@ -428,7 +430,8 @@ def _handle_not_enabled_response(self, request, response, targets_zyte_api):
428430 retryreq = request .copy ()
429431 retryreq .dont_filter = True
430432 self ._inc_stat (
431- "retries/should_have_been_enabled" , targets_zyte_api = targets_zyte_api
433+ "retries/should_have_been_enabled" ,
434+ targets_zyte_api = targets_zyte_api ,
432435 )
433436 return retryreq
434437 return response
@@ -531,7 +534,8 @@ def _clean_zyte_smartproxy_headers(self, request, targets_zyte_api=None):
531534 "request is proxied with %s and not with %s, and "
532535 "automatic translation is not supported for this "
533536 "header. See "
534- "https://docs.zyte.com/zyte-api/migration/zyte/smartproxy.html#parameter-mapping" # noqa
537+ "https://docs.zyte.com/zyte-api/migration/zyte/"
538+ "smartproxy.html#parameter-mapping"
535539 " to learn the right way to translate this header "
536540 "manually."
537541 ),
@@ -557,11 +561,13 @@ def _set_zyte_smartproxy_default_headers(self, request):
557561 header .decode ("utf-8" ).lower () for header in request .headers
558562 ]
559563 if all (h .lower () in lower_case_headers for h in self .conflicting_headers ):
560- # Send a general warning once, and specific urls if LOG_LEVEL = DEBUG
564+ # Send a general warning once,
565+ # and specific urls if LOG_LEVEL = DEBUG
561566 warnings .warn (
562567 "The headers %s are conflicting on some of your requests. "
563568 "Please check "
564- "https://docs.zyte.com/smart-proxy-manager.html#request-headers "
569+ "https://docs.zyte.com/smart-proxy-manager.html"
570+ "#request-headers "
565571 "for more information. You can set LOG_LEVEL=DEBUG to see the "
566572 "urls with problems." % str (self .conflicting_headers )
567573 )
0 commit comments