I am an amateur programmer trying to build a Python app that will print out all of the tweets from my user_timeline. I have been able to receive a bearer token but I am having difficulty receiving data when making my request. The documentation says that I do not need to sign this request but rather put the bearer token in the header under "Authorization : " when making the request. Unfortunately, when I do this, I receive an Error 400 Bad Request in response. I am sure I am missing something simple but any advice or guidance would be most appreciated.
Thanks in advance.
host = 'api.twitter.com' url = '/1.1/statuses/user_timeline.json?count=100' reqbear = httplib.HTTPSConnection(host) reqbear.putrequest("GET", url) reqbear.putheader("Host", host) reqbear.putheader("Authorization", "Bearer%s" % base64.b64encode(bearer token)) reqbear.putheader("User-Agent", "Twittitron Five Thousand") reqbear.putheader("Content-Type" ,"application/json") reqbear.putheader("Content-Length", "140") reqbear.putheader("Accept-Encoding", "json") reqbear.endheaders() respbear = reqbear.getresponse() beardate = resp.read() print respbear.status, respbear.reason print beardate