authenticated https post

Assaf Lavie assaflavie at gmail.com
Wed Nov 1 08:45:04 EST 2006



On Nov 1, 3:28 pm, "Assaf Lavie" <assafla... at gmail.com> wrote:
> I think that library is obsolete. It uses http, instead of https.
>
> On Nov 1, 3:00 pm, Fredrik Lundh <fred... at pythonware.com> wrote:
>
> > assaf wrote:
> > > I'm trying to use Python to work with del.icio.us's API.
> > > Basically, I need to be able to do a simple https post, with
> > > username/password authentication.
> > > (For those interested, the del.icio.us API is here:
> > >http://del.icio.us/help/api/)
>
> > > I can't for the life of me find a simple https example code that
> > > works... I'm working on Windows, btw, if that makes any difference.tried  http://code.google.com/p/pydelicious/?
>
> > (it's linked from the "useful things that other people have made"
> > section on del.icio.us' help page, just above the "developers" section
> > where you found that api link).
>
> > </F>

You know what, it _is_ obsolete, but modifying it was a breeze. Thanks
for the tip.

For those interested, here's the gist of it:

# The following downloads and prints a XML file of all the bookmarks of
a given user:

import urllib2

authinfo = urllib2.HTTPBasicAuthHandler()
authinfo.add_password('del.icio.us API',
	'https://api.del.icio.us',
	'<username>',
	'<pwd>')

urllib2.install_opener(urllib2.build_opener(authinfo))

print urllib2.urlopen('https://api.del.icio.us/v1/posts/all?').read()




More information about the Python-list mailing list