You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that urllib allows to specify the realm of a HTTPDigestAuth but the requests library doesn't allow it. Is it possible to add it on the standard requests library?
There are many devices that specify the realm where it is not the url domain name.
It is possible to do it with the urllib library that requests uses underneath.
I noticed that urllib allows to specify the realm of a HTTPDigestAuth but the requests library doesn't allow it. Is it possible to add it on the standard requests library?
There are many devices that specify the realm where it is not the url domain name.
It is possible to do it with the urllib library that requests uses underneath.
Example (A Hickvision network camera):
#0000: GET /ISAPI/notification/alertStream HTTP/1.1
#002e: Host: 192.168.10.64
#43: Authorization: Digest username="admin",realm="iDS-TCM403-BI",non
#83: ce="4e45497a4d4459774e45553659544d334d6d55344d7a6b3d",uri="/ISAP
#00c3: I/notification/alertStream",cnonce="c9bc93c864ef47d8e6879678ad85
#103: 511c",nc=00000001,algorithm=MD5,response="ffeaecca50dc4b23a7bc68
#143: 6c0200c339",qop="auth"
#015b: User-Agent: curl/8.10.1
#174: Accept: /
#181: Connection: keep-alive
Where it would be a good idea to implement it:
from requests.auth import HTTPDigestAuth
At the auth.py file
It now only accepts two parameters:
https://requests.readthedocs.io/en/latest/user/authentication/
Use example with urllib without the requests library:
import urllib
import urllib.request
Examples:
Username="oneusername"
Password="onepassword"
Realm ="iDS-TCM403-BI"
password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()
password_mgr.add_password(Realm, "http://192.168.10.64/", Username, Password)
handler = urllib.request.HTTPDigestAuthHandler(password_mgr)
opener = urllib.request.build_opener(handler)
urllib.request.install_opener(opener)
response = urllib.request.urlopen(URL)
=========================================
The text was updated successfully, but these errors were encountered: