Skip to content

Conversation

@Laerte
Copy link
Collaborator

@Laerte Laerte commented Mar 19, 2025

fix: #132
fix: #131

@Gallaecio
Copy link
Contributor

Besides addressing the CI issues (assuming they are valid and related to this change), before we merge, have you tried this branch on your code, made sure it works as expected? Just to be sure there is no other issue in that scenario, since this is not an issue where tests can help much.

@codecov
Copy link

codecov bot commented Mar 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (8b16f37) to head (c76ba2d).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #133   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            3         3           
  Lines          323       323           
=========================================
  Hits           323       323           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Gallaecio
Copy link
Contributor

Gallaecio commented Mar 20, 2025

I just experienced the twine error myself in a different repo, upgrading the version of twine in tox.ini will solve that.

@Gallaecio
Copy link
Contributor

The pre-commit issue is easy to address, tox -e pre-commit. I wonder why we have 2 CI jobs for pre-commit…

The min job issue appears a bit more involved, and CI-specific. Shall I take over to address it?

@Laerte
Copy link
Collaborator Author

Laerte commented Mar 20, 2025

Install package from my code:

pip install -e git+http://github.com/Laerte/scrapy-zyte-smartproxy.git@master#egg=scrapy-zyte-smartproxy

Run the spider:

scrapy runspider example.py
from uuid import uuid4

from scrapy import Spider
from scrapy.http import Request


class ExampleSpider(Spider):
    name = "example_spider"

    custom_settings = {
        "ZYTE_SMARTPROXY_ENABLED": True,
    }

    def start_requests(self):
        yield Request(
            "https://httpbin.org/status/429",
        )

    def parse(self, response):
        pass

With this I see the zyte_api_proxy/response/banned=1 stats.

@Laerte Laerte requested a review from Gallaecio March 20, 2025 10:51
@Gallaecio
Copy link
Contributor

Shall I take over, to try and solve the CI issue?

@Laerte
Copy link
Collaborator Author

Laerte commented Mar 20, 2025

Shall I take over, to try and solve the CI issue?

Now the error is not related to CI but with one failing test: test_is_banned because stats is not incremented (because short-circuit on if not self._is_zyte_smartproxy_or_zapi_response(response)) but tbh I confused with this function, the idea here is check if smartproxy (crawlera) or Zyte API response?

@Laerte Laerte self-assigned this Mar 20, 2025
@Laerte
Copy link
Collaborator Author

Laerte commented Mar 20, 2025

Shall I take over, to try and solve the CI issue?

Now the error is not related to CI but with one failing test: test_is_banned because stats is not incremented (because short-circuit on if not self._is_zyte_smartproxy_or_zapi_response(response)) but tbh I confused with this function, the idea here is check if smartproxy (crawlera) or Zyte API response?

Just to clarify and add this to docstring:
_is_zyte_smartproxy_or_zapi_response -> Checks if is a response from Crawlera or Zyte Smart Proxy? Because the current name it feels like Zyte API (which don't make sense since Zyte API is another thing).

@Gallaecio
Copy link
Contributor

Gallaecio commented Mar 20, 2025

scrapy-zyte-smartproxy is a package that allows using 2 different proxy APIs from Zyte: Smart Proxy Manager and Zyte API proxy mode. In the context of this package, Zyte API always refers specifically to the proxy mode, i.e. the proxy API of Zyte API (which also has an HTTP API).

@Laerte
Copy link
Collaborator Author

Laerte commented Mar 20, 2025

scrapy-zyte-smartproxy is a package that allows using 2 different proxy APIs from Zyte: Smart Proxy Manager and Zyte API proxy mode. In the context of this package, Zyte API always refers specifically to the proxy mode, i.e. the proxy API of Zyte API (which also has an HTTP API).

Cool, added docstring to be clear for everyone else as well.

@Laerte
Copy link
Collaborator Author

Laerte commented Mar 20, 2025

@Gallaecio seems we tried the same thing at same time, I tested with lower-version OS did not work but explicit installing gcc did. 😆

@Gallaecio Gallaecio requested a review from wRAR March 20, 2025 12:38
@wRAR wRAR merged commit 84961cf into scrapy-plugins:master Mar 20, 2025
14 checks passed
@Laerte
Copy link
Collaborator Author

Laerte commented Mar 21, 2025

@Gallaecio @wRAR May I ask, when we will have a new version of the lib with this change? Thank in advance.

@Gallaecio
Copy link
Contributor

Early next week, hopefully before Monday end-of-day.

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.

Banned stats is not incremented The 2.7 (min) test env installation broke

3 participants