Hello Mate,
I used to send tweet through my application successfully without any
trouble but today I keep getting an "401: Unauthorized" when I send a
tweet from my application... Here is the code :
def postTweets():
try:
import urllib, urllib2, base64
import gluon.contrib.simplejson as sj
args= urllib.urlencode([('status',"My Message")])
headers={}
headers['Authorization'] = 'Basic
'+base64.b64encode("userName"+':' +"password")
request = urllib2.Request('http://twitter.com/statuses/
update.json', args, headers)
return sj.loads(urllib2.urlopen(request).read())
except Exception:
print 'Problem here'
raise
Here is the error I'm getting:
.....
....
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/urllib2.py", line 506, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 401: Unauthorized
Please any help... thanks