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

How to setup proxyInfo with Luminati (https://brightdata.com/) #214

Open
workingxx92 opened this issue Nov 21, 2021 · 4 comments
Open

How to setup proxyInfo with Luminati (https://brightdata.com/) #214

workingxx92 opened this issue Nov 21, 2021 · 4 comments

Comments

@workingxx92
Copy link

workingxx92 commented Nov 21, 2021

This code below is not working

proxy_info = httplib2.ProxyInfo(httplib2.socks.PROXY_TYPE_HTTP_NO_TUNNEL,
                                'zproxy.lum-superproxy.io', 22225,
                                proxy_user='user',
                                proxy_pass='pass')
client = httplib2.Http(proxy_info=proxy_info)

response, body = client.request('http://lumtest.com/myip.json')
print('response', response, body)

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 993, in send
    self.sock.sendall(data)
  File "/Users/macbookpro/Desktop/Dev/python_env/local_env/lib/python3.7/site-packages/httplib2/socks.py", line 182, in sendall
    content = self.__rewriteproxy(content)
  File "/Users/macbookpro/Desktop/Dev/python_env/local_env/lib/python3.7/site-packages/httplib2/socks.py", line 191, in __rewriteproxy
    hdrs = header.split("\r\n")
TypeError: a bytes-like object is required, not 'str'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/macbookpro/PycharmProjects/storedbservice/Public.py", line 27, in <module>
    response, body = client.request('http://lumtest.com/myip.json')
  File "/Users/macbookpro/Desktop/Dev/python_env/local_env/lib/python3.7/site-packages/httplib2/__init__.py", line 1994, in request
    cachekey,
  File "/Users/macbookpro/Desktop/Dev/python_env/local_env/lib/python3.7/site-packages/httplib2/__init__.py", line 1651, in _request
    conn, request_uri, method, body, headers
  File "/Users/macbookpro/Desktop/Dev/python_env/local_env/lib/python3.7/site-packages/httplib2/__init__.py", line 1558, in _conn_request
    conn.request(method, request_uri, body, headers)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1277, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1323, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1272, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1032, in _send_output
    self.send(msg)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 997, in send
    self.sock.sendall(d)
  File "/Users/macbookpro/Desktop/Dev/python_env/local_env/lib/python3.7/site-packages/httplib2/socks.py", line 182, in sendall
    content = self.__rewriteproxy(content)
  File "/Users/macbookpro/Desktop/Dev/python_env/local_env/lib/python3.7/site-packages/httplib2/socks.py", line 191, in __rewriteproxy
    hdrs = header.split("\r\n")
AttributeError: 'int' object has no attribute 'split'

Thanks

@temoto
Copy link
Member

temoto commented Nov 21, 2021

Please show httplib2 and socks* lines from pip freeze.

@workingxx92
Copy link
Author

Hi
@temoto

httplib2 == 0.18.1

@temoto
Copy link
Member

temoto commented Nov 21, 2021

Please always try latest version pip install -U httplib2

@workingxx92
Copy link
Author

Screen Shot 2021-11-21 at 4 46 18 PM
I updated libs and got an error

File "/Users/macbookpro/Desktop/Dev/python_env/local_env/lib/python3.7/site-packages/httplib2/init.py", line 1726, in request
conn, authority, uri, request_uri, method, body, headers, redirections, cachekey,
File "/Users/macbookpro/Desktop/Dev/python_env/local_env/lib/python3.7/site-packages/httplib2/init.py", line 1441, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "/Users/macbookpro/Desktop/Dev/python_env/local_env/lib/python3.7/site-packages/httplib2/init.py", line 1364, in _conn_request
conn.request(method, request_uri, body, headers)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1277, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1323, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1272, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1032, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 997, in send
self.sock.sendall(d)
File "/Users/macbookpro/Desktop/Dev/python_env/local_env/lib/python3.7/site-packages/httplib2/socks.py", line 182, in sendall
content = self.__rewriteproxy(content)
File "/Users/macbookpro/Desktop/Dev/python_env/local_env/lib/python3.7/site-packages/httplib2/socks.py", line 191, in __rewriteproxy
hdrs = header.split("\r\n")
AttributeError: 'int' object has no attribute 'split'

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