authenticated https post

A

assaf

(warning Python newbie)

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.

Appreciate your help,
assaf
 
F

Fredrik Lundh

assaf said:
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>
 
A

Assaf Lavie

I think that library is obsolete. It uses http, instead of https.

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()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top