Jump to content
Chapter 3 Questions For Send_To_Twitter
1 reply to this topic
Posted 10 July 2015 - 12:14 AM
After I copy the code for send_to_twitter in chapter 3, I got this result from the shell. Anyone can explain for me?
do you want the realtime price?(Y/N)Yes
Traceback (most recent call last):
File "C:\Users\lihuiwen\Desktop\function_get_bean_price.py", line 26, in <module>
File "C:\Users\lihuiwen\Desktop\\function_get_bean_price.py", line 21, in send_to_twitter
resp = urllib.request.urlopen("http://twitter.com/s...s/update.json",params)
File "E:\python\lib\urllib\request.py", line 153, in urlopen
return opener.open(url, data, timeout)
File "E:\python\lib\urllib\request.py", line 453, in open
req = meth(req)
File "E:\python\lib\urllib\request.py", line 1104, in do_request_
TypeError: POST data should be bytes or an iterable of bytes. It cannot be of type str.
Posted 12 July 2015 - 04:08 AM
Hi suckingspider, that's because twitter has changed method of authentication, method of making an app with twitter api and data retrieval etc.; but the book don't have that method and code updated since its launch probably.
Alternatively, I have a tutorial on my blog. You can follow that in the below link. If still any problem persists; you can ask here or there in my blog.
Link to my blog - http://candpy-progs....rogramming.html
Edited by #TM#, 12 July 2015 - 04:09 AM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users