Twython().search(q="anythong") throws unicode2utf8() takes exactly 1 argument (2 given) #103

Closed
opened 2012-06-27 22:51:38 -07:00 by apardata · 3 comments
apardata commented 2012-06-27 22:51:38 -07:00 (Migrated from github.com)

I am using Ubuntu 11.10 and installed using sudo pip install twython.

t = Twython()
t.search(q='London')
usr/local/lib/python2.7/dist-packages/twython-2.3.0-py2.7.egg/twython/twython.pyc in search(self, **kwargs)
384 """
385 if 'q' in kwargs:
--> 386 kwargs['q'] = urllib.quote_plus(Twython.unicode2utf8(kwargs['q'], ':'))
387
388 return self.get('https://search.twitter.com/search.json', params=kwargs)

TypeError: unicode2utf8() takes exactly 1 argument (2 given)

Am i missing some dependency. I am using Python version: '2.7.2+ (default, Oct 4 2011, 20:06:09) \n[GCC 4.6.1]'
othe API's like getDailyTrends() work fine.

I am using Ubuntu 11.10 and installed using sudo pip install twython. > t = Twython() > t.search(q='London') > usr/local/lib/python2.7/dist-packages/twython-2.3.0-py2.7.egg/twython/twython.pyc in search(self, **kwargs) > 384 """ > 385 if 'q' in kwargs: > --> 386 kwargs['q'] = urllib.quote_plus(Twython.unicode2utf8(kwargs['q'], ':')) > 387 > 388 return self.get('https://search.twitter.com/search.json', params=kwargs) TypeError: unicode2utf8() takes exactly 1 argument (2 given) Am i missing some dependency. I am using Python version: '2.7.2+ (default, Oct 4 2011, 20:06:09) \n[GCC 4.6.1]' othe API's like getDailyTrends() work fine.
ryanmcgrath commented 2012-06-29 08:48:03 -07:00 (Migrated from github.com)

Looks like @michaelhelmick is on this, we'll merge it when his other patches are good to go. Thanks for filing!

Looks like @michaelhelmick is on this, we'll merge it when his other patches are good to go. Thanks for filing!
apardata commented 2012-07-04 17:44:08 -07:00 (Migrated from github.com)

Thanks for the quick fix.

Thanks for the quick fix.
get2dandy commented 2012-11-06 13:20:12 -08:00 (Migrated from github.com)

Hi,

I am trying to develop a small program. I can use getUserTimeline & getWeeklyTrends from using proxy but when I try to use search I get below error.

Traceback (most recent call last):
File "search_results.py", line 9, in
print twitter.search(q='python')
File "C:\Python26\lib\site-packages\twython\twython.py", line 368, in search
return self.get('https://search.twitter.com/search.json', params=kwargs)
File "C:\Python26\lib\site-packages\twython\twython.py", line 239, in get
return self.request(endpoint, params=params, version=version)
File "C:\Python26\lib\site-packages\twython\twython.py", line 234, in request
content = self.request(url, method=method, params=params, files=files, api
call=url)
File "C:\Python26\lib\site-packages\twython\twython.py", line 171, in _request

response = func(url, params=params)

File "C:\Python26\Lib\site-packages\requests\sessions.py", line 254, in get
return self.request('get', url, **kwargs)
File "C:\Python26\Lib\site-packages\requests\sessions.py", line 241, in reques
t
r.send(prefetch=prefetch)
File "C:\Python26\Lib\site-packages\requests\models.py", line 634, in send
raise ConnectionError(sockerr)
requests.exceptions.ConnectionError: [Errno 10051] A socket operation was attemp
ted to an unreachable network

Am I missing something here?

Thanks in advance,
Dhananjay

Hi, I am trying to develop a small program. I can use getUserTimeline & getWeeklyTrends from using proxy but when I try to use search I get below error. Traceback (most recent call last): File "search_results.py", line 9, in <module> print twitter.search(q='python') File "C:\Python26\lib\site-packages\twython\twython.py", line 368, in search return self.get('https://search.twitter.com/search.json', params=kwargs) File "C:\Python26\lib\site-packages\twython\twython.py", line 239, in get return self.request(endpoint, params=params, version=version) File "C:\Python26\lib\site-packages\twython\twython.py", line 234, in request content = self._request(url, method=method, params=params, files=files, api_ call=url) File "C:\Python26\lib\site-packages\twython\twython.py", line 171, in _request ``` response = func(url, params=params) ``` File "C:\Python26\Lib\site-packages\requests\sessions.py", line 254, in get return self.request('get', url, **kwargs) File "C:\Python26\Lib\site-packages\requests\sessions.py", line 241, in reques t r.send(prefetch=prefetch) File "C:\Python26\Lib\site-packages\requests\models.py", line 634, in send raise ConnectionError(sockerr) requests.exceptions.ConnectionError: [Errno 10051] A socket operation was attemp ted to an unreachable network Am I missing something here? Thanks in advance, Dhananjay
Sign in to join this conversation.
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#103
No description provided.