10000 How to setup proxyInfo with Luminati (https://brightdata.com/) · Issue #214 · httplib2/httplib2 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
How to setup proxyInfo with Luminati (https://brightdata.com/) #214
Open
@workingxx92

Description

@workingxx92

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0