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

Bug in httplib2 patch #92

Closed
anvu03 opened this issue Dec 21, 2017 · 4 comments · Fixed by #200
Closed

Bug in httplib2 patch #92

anvu03 opened this issue Dec 21, 2017 · 4 comments · Fixed by #200

Comments

@anvu03
Copy link

anvu03 commented Dec 21, 2017

I tried to use httplib2 patch as shown in geventhttpclient.

import geventhttpclient.httplib
geventhttpclient.httplib.patch()

import httplib2

h = httplib2.Http()
h.request("http://api.gdax.com/currencies", "GET")

Here is there error i had:

C:\Users\aqv13\AppData\Local\Programs\Python\Python36-32\python.exe C:/Users/aqv13/PycharmProjects/untitled1/main.py
Traceback (most recent call last):
  File "C:/Users/aqv13/PycharmProjects/untitled1/main.py", line 7, in <module>
    h.request("http://api.gdax.com/currencies", "GET")
  File "C:\Users\aqv13\AppData\Local\Programs\Python\Python36-32\lib\site-packages\httplib2\__init__.py", line 1322, in request
    (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
  File "C:\Users\aqv13\AppData\Local\Programs\Python\Python36-32\lib\site-packages\httplib2\__init__.py", line 1124, in _request
    headers=headers, redirections=redirections - 1)
  File "C:\Users\aqv13\AppData\Local\Programs\Python\Python36-32\lib\site-packages\httplib2\__init__.py", line 1204, in request
    self.disable_ssl_certificate_validation)
  File "C:\Users\aqv13\AppData\Local\Programs\Python\Python36-32\lib\site-packages\httplib2\__init__.py", line 858, in __init__
    check_hostname=disable_ssl_certificate_validation ^ True)
  File "C:\Users\aqv13\AppData\Local\Programs\Python\Python36-32\lib\site-packages\geventhttpclient\httplib.py", line 118, in __init__
    HTTPConnection.__init__(self, host, port, **kw)
  File "C:\Users\aqv13\AppData\Local\Programs\Python\Python36-32\lib\site-packages\geventhttpclient\httplib.py", line 95, in __init__
    HTTPLibConnection.__init__(self, *args, **kw)
TypeError: __init__() got an unexpected keyword argument 'context'

Process finished with exit code 1
@kamilhlawiczka
Copy link

Hi @anvu03,

I had the same issue. Issue occurs with connections using https. I resolved it in that way:
(kamilhlawiczka@289bac0)

below is pip install command (just copy and paste)
pip install -e git+https://github.com/kamilhlawiczka/geventhttpclient.git@issue-92_https_fix_for_httplib2#venthttpclient

@cyberw
Copy link
Collaborator

cyberw commented May 22, 2020

Is this still an issue? Closing due to lack of activity but we can reopen if needed.

@cyberw cyberw closed this as completed May 22, 2020
@tomaszhlawiczka
Copy link

It is still there:

python -mvenv test4
./test4/bin/pip install -U pip
# Successfully installed pip-23.3.1
./test4/bin/pip install geventhttpclient
# Successfully installed brotli-1.1.0 certifi-2023.7.22 gevent-23.9.1 geventhttpclient-2.0.11 greenlet-3.0.1 six-1.16.0 zope.event-5.0 zope.interface-6.1
./test4/bin/pip install httplib2
# Successfully installed httplib2-0.22.0 pyparsing-3.1.1

./test4/bin/python

Python 3.11.5 (main, Sep  2 2023, 10:01:39) [GCC 11.3.1 20221209] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import geventhttpclient.httplib; geventhttpclient.httplib.patch()
>>> import httplib2
>>> httplib2.Http().request('https://google.pl', method='GET')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/users/me/test4/lib/python3.11/site-packages/httplib2/__init__.py", line 1581, in request
    conn = self.connections[conn_key] = connection_type(
                                        ^^^^^^^^^^^^^^^^
  File "/home/users/me/test4/lib/python3.11/site-packages/httplib2/__init__.py", line 1109, in __init__
    super(HTTPSConnectionWithTimeout, self).__init__(
  File "/home/users/me/test4/lib/python3.11/site-packages/geventhttpclient/httplib.py", line 118, in __init__
    HTTPConnection.__init__(self, host, port, **kw)
  File "/home/users/me/test4/lib/python3.11/site-packages/geventhttpclient/httplib.py", line 95, in __init__
    HTTPLibConnection.__init__(self, *args, **kw)
TypeError: HTTPConnection.__init__() got an unexpected keyword argument 'context'

./test4/bin/pip freeze

certifi==2023.7.22
gevent==23.9.1
geventhttpclient==2.0.11
greenlet==3.0.1
httplib2==0.22.0
pyparsing==3.1.1
six==1.16.0
zope.event==5.0
zope.interface==6.1

@tomaszhlawiczka
Copy link

@cyberw could you please reopen this bug?

@ml31415 ml31415 reopened this Nov 6, 2023
ml31415 added a commit that referenced this issue Apr 10, 2024
Improves httplib2 patching

Fixes #92

Improves benchmarks and examples
ml31415 added a commit that referenced this issue Apr 10, 2024
Improves httplib2 patching

Fixes #92

Improves benchmarks and examples
ml31415 added a commit that referenced this issue Apr 10, 2024
Improves httplib2 patching

Fixes #92

Improves benchmarks and examples
ml31415 added a commit that referenced this issue Apr 10, 2024
Improves httplib2 patching

Fixes #92

Improves benchmarks and examples
ml31415 added a commit that referenced this issue Apr 11, 2024
Improves httplib2 patching

Fixes #92

Improves benchmarks and examples
ml31415 added a commit that referenced this issue Apr 11, 2024
Improves httplib2 patching

Fixes #92

Improves benchmarks and examples
ml31415 added a commit that referenced this issue Apr 11, 2024
Fixes http.client patching #92

Improves httplib2 interoperability, provides a drop-in replacement

Improves benchmarks and examples
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 a pull request may close this issue.

5 participants