I don't know if this is the solution, but Twitter is now requiring
OAuth instead of the previous Basic Auth. They've warned that many
apps would stop working. See http://dev.twitter.com/pages/basic_to_oauth
--
Michael McGinnis

On Sep 4, 5:39 pm, Yannick <ytchatch...@gmail.com> wrote:
> 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

Reply via email to