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
Zahra Rajabi
tweepy
Commits
ce744c5f
Commit
ce744c5f
authored
Oct 14, 2009
by
Josh Roesslein
Browse files
Only utf-8 encode unicode parameters in binder.
parent
b97038e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
tweepy/binder.py
View file @
ce744c5f
...
...
@@ -44,9 +44,10 @@ def bind_api(path, parser, allowed_param=[], method='GET', require_auth=False,
if
allowed_param
:
parameters
=
{}
for
idx
,
arg
in
enumerate
(
args
):
encoded_arg
=
arg
.
encode
(
'utf-8'
)
# must encode parameters to utf-8
if
isinstance
(
arg
,
unicode
):
arg
=
arg
.
encode
(
'utf-8'
)
try
:
parameters
[
allowed_param
[
idx
]]
=
encoded_
arg
parameters
[
allowed_param
[
idx
]]
=
arg
except
IndexError
:
raise
TweepError
(
'Too many parameters supplied!'
)
for
k
,
arg
in
kargs
.
items
():
...
...
@@ -56,7 +57,9 @@ def bind_api(path, parser, allowed_param=[], method='GET', require_auth=False,
raise
TweepError
(
'Multiple values for parameter %s supplied!'
%
k
)
if
k
not
in
allowed_param
:
raise
TweepError
(
'Invalid parameter %s supplied!'
%
k
)
parameters
[
k
]
=
arg
.
encode
(
'utf-8'
)
if
isinstance
(
arg
,
unicode
):
arg
=
arg
.
encode
(
'utf-8'
)
parameters
[
k
]
=
arg
else
:
if
len
(
args
)
>
0
or
len
(
kargs
)
>
0
:
raise
TweepError
(
'This method takes no parameters!'
)
...
...
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