summaryrefslogtreecommitdiff
path: root/gitlab
diff options
context:
space:
mode:
authorCosimo Lupo <cosimo.lupo@daltonmaag.com>2017-06-02 14:41:06 +0100
committerGauvain Pocentek <gauvain@pocentek.net>2017-06-02 15:41:06 +0200
commit88900e06761794442716c115229bd1f780cfbcef (patch)
tree6011ab17b9be02e62ea141e037b7b1afdeafd02d /gitlab
parent38bff3eb43ee6526b3e3b35c8207fac9ef9bc9d9 (diff)
downloadgitlab-88900e06761794442716c115229bd1f780cfbcef.tar.gz
import urlencode() from six.moves.urllib.parse instead of from urllib (#268)
Fixes AttributeError on Python 3, as `urlencode` function has been moved to `urllib.parse` module. `six.moves.urllib.parse.urlencode()` is an py2.py3 compatible alias of `urllib.parse.urlencode()` on Python 3, and of `urllib.urlencode()` on Python 2.
Diffstat (limited to 'gitlab')
-rw-r--r--gitlab/v3/objects.py6
-rw-r--r--gitlab/v4/objects.py4
2 files changed, 5 insertions, 5 deletions
diff --git a/gitlab/v3/objects.py b/gitlab/v3/objects.py
index b2fd180..84b9cb5 100644
--- a/gitlab/v3/objects.py
+++ b/gitlab/v3/objects.py
@@ -20,10 +20,10 @@ from __future__ import division
from __future__ import absolute_import
import base64
import json
-import urllib
import warnings
import six
+from six.moves import urllib
import gitlab
from gitlab.base import * # noqa
@@ -1841,7 +1841,7 @@ class Project(GitlabObject):
url = "/projects/%s/repository/tree" % (self.id)
params = []
if path:
- params.append(urllib.urlencode({'path': path}))
+ params.append(urllib.parse.urlencode({'path': path}))
if ref_name:
params.append("ref_name=%s" % ref_name)
if params:
@@ -1872,7 +1872,7 @@ class Project(GitlabObject):
GitlabGetError: If the server fails to perform the request.
"""
url = "/projects/%s/repository/blobs/%s" % (self.id, sha)
- url += '?%s' % (urllib.urlencode({'filepath': filepath}))
+ url += '?%s' % (urllib.parse.urlencode({'filepath': filepath}))
r = self.gitlab._raw_get(url, streamed=streamed, **kwargs)
raise_error_from_response(r, GitlabGetError)
return utils.response_content(r, streamed, action, chunk_size)
diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py
index 83790bf..6283149 100644
--- a/gitlab/v4/objects.py
+++ b/gitlab/v4/objects.py
@@ -20,9 +20,9 @@ from __future__ import division
from __future__ import absolute_import
import base64
import json
-import urllib
import six
+from six.moves import urllib
import gitlab
from gitlab.base import * # noqa
@@ -1846,7 +1846,7 @@ class Project(GitlabObject):
url = "/projects/%s/repository/tree" % (self.id)
params = []
if path:
- params.append(urllib.urlencode({'path': path}))
+ params.append(urllib.parse.urlencode({'path': path}))
if ref:
params.append("ref=%s" % ref)
if params: