Example of digestauth in python?

539 views
Skip to first unread message

pratibha natani

unread,
May 20, 2014, 5:49:23 PM5/20/14
to repo-d...@googlegroups.com

Does anyone has a code example of using digestauth in python?

I can access below api using curl, with user's http password:

But I cant make find any example of digestauth in python that works.

Thanks
Pratibha

Nasser Grainawi

unread,
May 20, 2014, 6:37:22 PM5/20/14
to pratibha natani, repo-d...@googlegroups.com
Maybe try the python 'requests' package?

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora 
Forum, hosted by The Linux Foundation

Matthias Sohn

unread,
May 20, 2014, 6:41:14 PM5/20/14
to pratibha natani, Repo and Gerrit Discussion

pratibha natani

unread,
May 20, 2014, 8:03:57 PM5/20/14
to repo-d...@googlegroups.com

I got this example working, if it may help someone. Used http password for the username (user's settings in gerrit)

import requests

from requests.auth import HTTPDigestAuth

url = 'http://serverhost.com/a/changes/?o=CURRENT_COMMIT&o=CURRENT_REVISION'

res = requests.get(url, auth=HTTPDigestAuth('username', 'password'))

#print res.__dict__

for k,v in res.__dict__.iteritems():

        print "\nproperty:", k

        print "\nvalue:", v

-pratibha
Reply all
Reply to author
Forward
0 new messages