Skip to content

Commit 7664ac3

Browse files
committed
Drop urllib3 requirement
Changes in `urllib3:2.0` made the parts we use private methods. this means we should not have been using those and that we were incompatible with v2. Replacing it with `urllib.parse` as a dependency gives us the same results but with one less library to be compatible with.
1 parent db49c29 commit 7664ac3

4 files changed

Lines changed: 6 additions & 4 deletions

File tree

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ PyYAML==4.2b1
44
requests==2.20.0
55
sh==1.11
66
six==1.10.0
7-
urllib3==1.23
87
mock==2.0.0

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
version=VERSION,
1111
description="Python client for Usabilla API",
1212
license='MIT',
13-
install_requires=['urllib3', 'requests'],
13+
install_requires=['requests'],
1414
packages=find_packages(),
1515
py_modules=['usabilla'],
1616
author='Usabilla',

tests.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ def test_query_parameters(self):
8484
params = {'limit': 1, 'since': 1235454}
8585
self.client.set_query_parameters(params)
8686
self.assertEqual(self.client.get_query_parameters(), 'limit=1&since=1235454')
87+
params = {'limit': 1, 'since': 1235454, 'text': 'the little old lady'}
88+
self.client.set_query_parameters(params)
89+
self.assertEqual(self.client.get_query_parameters(), 'limit=1&since=1235454&text=the+little+old+lady')
8790

8891
def test_check_resource_validity(self):
8992
with self.assertRaises(ub.GeneralError):

usabilla.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import hashlib
2323
import hmac
2424
import requests
25-
import urllib3.request as urllib
25+
import urllib.parse
2626

2727
from collections import OrderedDict
2828

@@ -153,7 +153,7 @@ def set_query_parameters(self, parameters):
153153
:type parameters: dict
154154
"""
155155

156-
self.query_parameters = urllib.urlencode(OrderedDict(sorted(parameters.items())))
156+
self.query_parameters = urllib.parse.urlencode(OrderedDict(sorted(parameters.items())))
157157

158158
def get_query_parameters(self):
159159
"""Get the query parameters."""

0 commit comments

Comments
 (0)