Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
kamaki
Commits
e4402a21
Commit
e4402a21
authored
Mar 04, 2014
by
Stavros Sachtouris
Browse files
Quote the right part of the request URL
parent
c86c360d
Changes
1
Hide whitespace changes
Inline
Side-by-side
kamaki/clients/__init__.py
View file @
e4402a21
...
...
@@ -117,21 +117,21 @@ class RequestManager(Logged):
:returns: (scheme, netloc)
"""
url
=
_encode
(
str
(
url
))
if
url
else
'http://127.0.0.1/'
url
=
url
or
'http://127.0.0.1/'
url
+=
''
if
url
.
endswith
(
'/'
)
else
'/'
if
path
:
url
+=
_encode
(
path
[
1
:]
if
path
.
startswith
(
'/'
)
else
path
)
delim
=
'?'
for
key
,
val
in
params
.
items
():
val
=
quote
(
''
if
val
in
(
None
,
False
)
else
_encode
(
'%s'
%
val
))
val
=
quote
(
''
if
val
in
(
None
,
False
)
else
'%s'
%
_encode
(
val
))
url
+=
'%s%s%s'
%
(
delim
,
key
,
(
'=%s'
%
val
)
if
val
else
''
)
delim
=
'&'
parsed
=
urlparse
(
url
)
self
.
url
=
url
self
.
path
=
parsed
.
path
or
'/'
self
.
url
=
_encode
(
u
'%s'
%
url
)
self
.
path
=
_encode
((
u
'%s'
%
parsed
.
path
)
if
parsed
.
path
else
'/'
)
if
parsed
.
query
:
self
.
path
+=
'?%s'
%
parsed
.
query
return
(
parsed
.
scheme
,
parsed
.
netloc
)
return
(
_encode
(
parsed
.
scheme
)
,
_encode
(
parsed
.
netloc
)
)
def
__init__
(
self
,
method
,
url
,
path
,
...
...
@@ -176,8 +176,8 @@ class RequestManager(Logged):
self
.
_encode_headers
()
self
.
dump_log
()
conn
.
request
(
method
=
str
(
self
.
method
.
upper
()
)
,
url
=
str
(
self
.
path
),
method
=
self
.
method
.
upper
(),
url
=
(
'%s'
%
self
.
path
)
or
''
,
headers
=
self
.
headers
,
body
=
self
.
data
)
sendlog
.
info
(
''
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment