This could also just be a bug in the python code I'm using - maybe
even something in urllib2 going wrong.
Here is a bit of my code for reference, a function which makes an HTTP
POST with a username & password. For an existing friendship, this will
throw an exception printed out as:
<class 'urllib2.HTTPError'>
HTTP Error 403: Forbidden
<traceback object at 0x1ea38a0>
import sys
import urllib2
import urlparse
import json
def twitter_post_pw(url, data, twitter_username, twitter_password):
encoded_data = twitter_encode(data)
realm = "Twitter API"
(scheme, netloc, path, params, query, fragment) = urlparse.urlparse
(url)
handler = urllib2.HTTPBasicAuthHandler()
handler.add_password(realm, netloc, twitter_username,
twitter_password)
opener = urllib2.build_opener(handler)
try:
o = opener.open(url, encoded_data)
return json.read( o.read() )
except:
for e in sys.exc_info():
print e
return False
def twitter_encode( data ):
return urllib.urlencode(dict([(k, unicode(v).encode('utf-8')) for
k, v in data.items()]))
On Apr 17, 12:01 pm, Matt Sanford <[email protected]> wrote:
> Hi all,
>
> We're not seeing the 403s in our normal logs but we've seen a few
> in responses. We're looking into the issue and I'll send out more info
> when I have it.
>
> — Matt
>
> On Apr 17, 2009, at 07:27 AM, Abraham Williams wrote:
>
> > This seems to indicate it too.
>
> > The 403 Forbidden HTTP status code indicates that the client was
> > able to communicate with the server, but the server doesn't let the
> > user access what was requested.
>
> >http://en.wikipedia.org/wiki/HTTP_403
>
> > On Fri, Apr 17, 2009 at 07:46, Ivan <[email protected]> wrote:
>
> > Hi,
>
> > Twitter returns a HTTP 403 if you make a properly authorized follow
> > request to a user already followed.
>
> > That seems like the wrong kind of response. It should return 200, with
> > data saying the friendship already existed, no?
>
> > Ivan
> >http://tipjoy.com
>
> > --
> > Abraham Williams |http://the.hackerconundrum.com
> > Hacker |http://abrah.am|http://twitter.com/abraham
> > Web608 | Community Evangelist |http://web608.org
> > This email is: [ ] blogable [x] ask first [ ] private.
> > Sent from Madison, Wisconsin, United States