authenticated https post

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • assaf

    #1

    authenticated https post

    (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

  • Fredrik Lundh

    #2
    Re: authenticated https post

    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>

    Comment

    • Assaf Lavie

      #3
      Re: authenticated https post

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

      On Nov 1, 3:00 pm, Fredrik Lundh <fred...@python ware.comwrote:
      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.trie d 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>

      Comment

      • Assaf Lavie

        #4
        Re: authenticated https post



        On Nov 1, 3:28 pm, "Assaf Lavie" <assafla...@gma il.comwrote:
        I think that library is obsolete. It uses http, instead of https.
        >
        On Nov 1, 3:00 pm, Fredrik Lundh <fred...@python ware.comwrote:
        >
        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.trie d 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.HTTPBas icAuthHandler()
        authinfo.add_pa ssword('del.ici o.us API',
        'https://api.del.icio.us ',
        '<username>',
        '<pwd>')

        urllib2.install _opener(urllib2 .build_opener(a uthinfo))

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

        Comment

        Working...