Jump to content


Chapter 3 Questions For Send_To_Twitter

  • Please log in to reply
1 reply to this topic

#1 suckingspider


    New Member

  • Members
  • Pip
  • 2 posts

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_
    raise TypeError(msg)
TypeError: POST data should be bytes or an iterable of bytes. It cannot be of type str.

#2 #TM#


    Active Member

  • Members
  • PipPipPip
  • 91 posts
  • Gender:Not Telling

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. tongue.png


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 cool.png smile.png

Edited by #TM#, 12 July 2015 - 04:09 AM.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users