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

I am not able to connect to Bright Data's Scraping Browser.(their new proxy-zone) #446

Open
kiran-cj opened this issue Jul 12, 2023 · 0 comments

Comments

@kiran-cj
Copy link

The error that I got:
'''
(CJ_test) kirancj@Home AcceptTransfer % python3 original_at.py
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/encodings/idna.py", line 165, in encode
raise UnicodeError("label empty or too long")
UnicodeError: label empty or too long

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "original_at.py", line 27, in
asyncio.get_event_loop().run_until_complete(connect_to_scraping_browser())
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "original_at.py", line 21, in connect_to_scraping_browser
browser = await pyppeteer.connect({
File "/Users/kirancj/.local/share/virtualenvs/CJ_test-RO4vW2LI/lib/python3.8/site-packages/pyppeteer/launcher.py", line 350, in connect
browserWSEndpoint = get_ws_endpoint(browserURL)
File "/Users/kirancj/.local/share/virtualenvs/CJ_test-RO4vW2LI/lib/python3.8/site-packages/pyppeteer/launcher.py", line 229, in get_ws_endpoint
with urlopen(url) as f:
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 525, in open
response = self._open(req, data)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 542, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 502, in _call_chain
result = func(*args)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1383, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1354, in do_open
h.request(req.get_method(), req.selector, req.data, headers,
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1252, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1298, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1247, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1007, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 947, in send
self.connect()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 918, in connect
self.sock = self._create_connection(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/socket.py", line 787, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/socket.py", line 918, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
UnicodeError: encoding with 'idna' codec failed (UnicodeError: label empty or too long)
'''

python version - 3.8
pyppeteer version - 1.0.2

Sample code that I used:
async def connect_to_scraping_browser():
hostname = input("Enter the hostname: ")
username = input("Enter the username: ")
password = input("Enter the password: ")
try:
idna.encode(hostname)
except idna.IDNAError:
print("The hostname is invalid.")
return
browser = await pyppeteer.connect({
"browserURL": f"http://{username}:{password}@{hostname}:9222/json"
})

asyncio.get_event_loop().run_until_complete(connect_to_scraping_browser())

hostname entered is " brd.superproxy.io "

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

1 participant