
{"id":19118,"date":"2022-08-15T18:19:00","date_gmt":"2022-08-15T12:49:00","guid":{"rendered":"https:\/\/valavil.in\/?p=19118"},"modified":"2022-08-15T18:19:00","modified_gmt":"2022-08-15T12:49:00","slug":"program-to-do-digest-authentication-using-requests-module","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2022\/08\/15\/program-to-do-digest-authentication-using-requests-module\/","title":{"rendered":"Program to do digest authentication using requests module"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$cat  digest_authentication.py \n#!\/usr\/bin\/env python3\n\nimport requests\nfrom requests.auth import HTTPDigestAuth\n\nurl = 'http:\/\/httpbin.org\/digest-auth\/auth\/user\/pass'\nresponse = requests.get(url, auth=HTTPDigestAuth('user', 'pass'))\nprint('Response.status_code:'+ str(response.status_code))\nif response.status_code == 200:\n\tprint('Login successful :'+str(response.json()))\n$\n$python3 digest_authentication.py \nResponse.status_code:200\nLogin successful :{'authenticated': True, 'user': 'user'}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>$cat digest_authentication.py #!\/usr\/bin\/env python3 import requests from requests.auth import HTTPDigestAuth url = &#8216;http:\/\/httpbin.org\/digest-auth\/auth\/user\/pass&#8217; response = requests.get(url, auth=HTTPDigestAuth(&#8216;user&#8217;, &#8216;pass&#8217;)) print(&#8216;Response.status_code:&#8217;+ str(response.status_code)) if response.status_code == 200: print(&#8216;Login successful :&#8217;+str(response.json())) $ $python3 digest_authentication.py Response.status_code:200 Login successful :{&#8216;authenticated&#8217;: True, &#8216;user&#8217;: &#8216;user&#8217;}<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/19118"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=19118"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/19118\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=19118"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=19118"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=19118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}