corrected issue when searches with "q" gets encoded twice #93

Merged
leandroferreira merged 1 commit from master into master 2012-06-24 12:15:10 -07:00
leandroferreira commented 2012-05-31 07:01:44 -07:00 (Migrated from github.com)

When doing a search, the q parameter gets encoded twice.

Example:

code:
twitter = twython.Twython()
results = twitter.search(q='from:username')

result:
request via GET sending q=from%253Ausername

expected result:
request via GET sending q=from%3Ausername

The value is encoded on search:
kwargs['q'] = urllib.quote_plus(Twython.unicode2utf8(kwargs['q']))

and then on _request:
url = '%s?%s' % (url, urllib.urlencode(params))

I fixed It by passing a safe character to quote_plus:
kwargs['q'] = urllib.quote_plus(Twython.unicode2utf8(kwargs['q']), ':')

When doing a search, the q parameter gets encoded twice. Example: code: twitter = twython.Twython() results = twitter.search(q='from:username') result: request via GET sending q=from%253Ausername expected result: request via GET sending q=from%3Ausername The value is encoded on search: kwargs['q'] = urllib.quote_plus(Twython.unicode2utf8(kwargs['q'])) and then on _request: url = '%s?%s' % (url, urllib.urlencode(params)) I fixed It by passing a safe character to quote_plus: kwargs['q'] = urllib.quote_plus(Twython.unicode2utf8(kwargs['q']), ':')
ryanmcgrath commented 2012-06-24 12:15:14 -07:00 (Migrated from github.com)

Apologies for the delayed merge, just now getting back to normal workflows. Merged and good to go. Thanks!

Apologies for the delayed merge, just now getting back to normal workflows. Merged and good to go. Thanks!
leandroferreira commented 2012-06-24 14:47:09 -07:00 (Migrated from github.com)

Thanks for the merge, this app is turning out to be really useful for my sites!

Thanks for the merge, this app is turning out to be really useful for my sites!
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: code/twython#93
No description provided.