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

Issue with Proxy (requires unnecessary auth) #54

Open
Hollyqui opened this issue Dec 3, 2024 · 1 comment
Open

Issue with Proxy (requires unnecessary auth) #54

Hollyqui opened this issue Dec 3, 2024 · 1 comment

Comments

@Hollyqui
Copy link

Hollyqui commented Dec 3, 2024

I'm attempting to run this with zyte's rotating proxy as follows:

import primp
zyte_proxy = "http://MY_API_KEY:@api.zyte.com:8011"
client = primp.Client(proxy=zyte_proxy, verify=False)
resp = client.post(url="https://httpbin.org/anything", timeout=10)

and am getting this error:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[50], [line 4](vscode-notebook-cell:?execution_count=50&line=4)
      [2](vscode-notebook-cell:?execution_count=50&line=2) zyte_proxy = "[http://553152efe46f4d61b928826aa8147a51:@api.zyte.com:8011](http://[email protected]:8011/)"
      [3](vscode-notebook-cell:?execution_count=50&line=3) client = primp.Client(proxy=zyte_proxy, verify=False, impersonate="chrome_101")
----> [4](vscode-notebook-cell:?execution_count=50&line=4) resp = client.post(url="https://httpbin.org/anything", timeout=10)

RuntimeError: error sending request for url (https://httpbin.org/anything): error trying to connect: proxy authentication required

Caused by:
    0: error trying to connect: proxy authentication required
    1: proxy authentication required

In contrast, the same proxy works just fine using requests:

proxies = {
        scheme: "http://MY_API_KEY:@api.zyte.com:8011"
        for scheme in ("http")
}
import requests

response = requests.get(
    "https://toscrape.com",
    proxies=proxies,
    verify=False,
)
http_response_body: bytes = response.content
print(http_response_body.decode())
@deedy5
Copy link
Owner

deedy5 commented Dec 4, 2024

Although I haven't checked specifically with zyte, but primp works fine via proxy with authorization.
Check your api key.

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

No branches or pull requests

2 participants