Delicious API and urllib2
brentb at beanfield.com
Mon Apr 6 20:44:52 CEST 2009
> The delicious api requires http authorization (actually https). A
> generic delicious api post url is "https://
> username:password at api.api.del.icio.us/v1/posts/add?url=http://
> This works fine when entered in the Firefox address bar. However
> urllib2.urlopen(delicious_post_url) chokes and returns
> "httplib.InvalidURL: nonnumeric port: 'password at api.del.icio.us".
> Delicious really wants that authorization stuff embedded in the url as
> it also rejected my attempts at using urllib2.HTTPBasicAuthHandler(),
> Anybody have any hints?
What failure were you experiencing when you were using the
Did you follow the sample code from the docs?
> import urllib2
> # Create an OpenerDirector with support for Basic HTTP Authentication...
> auth_handler = urllib2.HTTPBasicAuthHandler()
> auth_handler.add_password(realm='PDQ Application',
> opener = urllib2.build_opener(auth_handler)
> # ...and install it globally so it can be used with urlopen.
More information about the Python-list