Skip to content

upgrade minimal required version of urllib3 #536

Closed
@ruzhnikov

Description

@ruzhnikov

It's needed to upgrade minimal required version of urllib3 at least to 1.10, because on version 1.9.1 it doesn't work(see below).

I tested on Debian 8 with python 3.4. By default, from DEB packages version urllib3-1.9.1 installed. So, I tried to init sentry and capture exception:

$ python3 -m pip show urllib3
Name: urllib3
Version: 1.9.1
Summary: HTTP library with thread-safe connection pooling, file post, and more.
Home-page: http://urllib3.readthedocs.org/
Author: Andrey Petrov
Author-email: andrey.petrov@shazow.net
License: MIT
Location: /usr/lib/python3/dist-packages
Requires: 
Required-by: sentry-sdk

$ python3
Python 3.4.2 (default, Sep 14 2019, 00:52:38) 
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> 
>>> 
>>> import sentry_sdk
>>> 
>>> 
>>> sentry_sdk.init(dsn="https://{}@{}/{}".format(sentry_token, sentry_server, sentry_project), debug=True)
 [sentry] DEBUG: Setting up integrations (with default = True)
 [sentry] DEBUG: Setting up previously not enabled integration modules
 [sentry] DEBUG: Setting up previously not enabled integration dedupe
 [sentry] DEBUG: Setting up previously not enabled integration argv
 [sentry] DEBUG: Setting up previously not enabled integration excepthook
 [sentry] DEBUG: Setting up previously not enabled integration stdlib
 [sentry] DEBUG: Setting up previously not enabled integration threading
 [sentry] DEBUG: Setting up previously not enabled integration atexit
 [sentry] DEBUG: Setting up previously not enabled integration logging
 [sentry] DEBUG: Enabling integration modules
 [sentry] DEBUG: Enabling integration dedupe
 [sentry] DEBUG: Enabling integration argv
 [sentry] DEBUG: Enabling integration excepthook
 [sentry] DEBUG: Enabling integration stdlib
 [sentry] DEBUG: Enabling integration threading
 [sentry] DEBUG: Enabling integration atexit
 [sentry] DEBUG: Enabling integration logging
<sentry_sdk.hub._InitGuard object at 0x7f2be72fca58>
>>> sentry_sdk.capture_exception(Exception("123"))
'b8117d5f256b46cd93f9d54a651609c1'
 [sentry] DEBUG: Sending event, type:null level:error event_id:b8117d5f256b46cd93f9d54a651609c1 project:20 host:....
>>>  [sentry] ERROR: Internal error in sentry_sdk
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/sentry_sdk/utils.py", line 50, in capture_internal_exceptions
    yield
  File "/usr/local/lib/python3.4/dist-packages/sentry_sdk/transport.py", line 208, in send_event_wrapper
    self._send_event(event)
  File "/usr/local/lib/python3.4/dist-packages/sentry_sdk/transport.py", line 143, in _send_event
    "Content-Encoding": "gzip",
  File "/usr/lib/python3/dist-packages/urllib3/request.py", line 72, in request
    **urlopen_kw)
  File "/usr/lib/python3/dist-packages/urllib3/request.py", line 135, in request_encode_body
    **urlopen_kw)
TypeError: urlopen() got multiple values for keyword argument 'body'

Ok, doesn't work. Let's try to use next version of urllib3:

$ python3 -m pip install --upgrade --user urllib3==1.10
Collecting urllib3==1.10
...
Installing collected packages: urllib3
Successfully installed urllib3-1.10

$ python3 -m pip show urllib3
Name: urllib3
Version: 1.10
Summary: HTTP library with thread-safe connection pooling, file post, and more.
Home-page: http://urllib3.readthedocs.org/
Author: Andrey Petrov
Author-email: andrey.petrov@shazow.net
License: MIT
Location: /user/.local/lib/python3.4/site-packages
Requires: 
Required-by: sentry-sdk

$ python3
Python 3.4.2 (default, Sep 14 2019, 00:52:38) 
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sentry_sdk
>>> sentry_sdk.init(dsn="https://{}@{}/{}".format(sentry_token, sentry_server, sentry_project), debug=True)
 [sentry] DEBUG: Setting up integrations (with default = True)
 [sentry] DEBUG: Setting up previously not enabled integration excepthook
 [sentry] DEBUG: Setting up previously not enabled integration threading
 [sentry] DEBUG: Setting up previously not enabled integration dedupe
 [sentry] DEBUG: Setting up previously not enabled integration logging
 [sentry] DEBUG: Setting up previously not enabled integration stdlib
 [sentry] DEBUG: Setting up previously not enabled integration modules
 [sentry] DEBUG: Setting up previously not enabled integration argv
 [sentry] DEBUG: Setting up previously not enabled integration atexit
 [sentry] DEBUG: Enabling integration excepthook
 [sentry] DEBUG: Enabling integration threading
 [sentry] DEBUG: Enabling integration dedupe
 [sentry] DEBUG: Enabling integration logging
 [sentry] DEBUG: Enabling integration stdlib
 [sentry] DEBUG: Enabling integration modules
 [sentry] DEBUG: Enabling integration argv
 [sentry] DEBUG: Enabling integration atexit
<sentry_sdk.hub._InitGuard object at 0x7f699d1d0a90>
>>> 
>>> 
>>> sentry_sdk.capture_exception(Exception("123"))
'7d0ad529c76947ecb787fa1f3aa6ca58'
 [sentry] DEBUG: Sending event, type:null level:error event_id:7d0ad529c76947ecb787fa1f3aa6ca58 project:20 host:.....
>>> 

Works perfectly! Please, do changes in your setup.py file. I spent on this bug almost all my work day)

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