Python3 using requests to grab HTTP Auth Data
Νίκος Βέργος
me.on.nzt at gmail.com
Wed Feb 1 15:48:57 EST 2017
Τη Τετάρτη, 1 Φεβρουαρίου 2017 - 9:22:46 μ.μ. UTC+2, ο χρήστης Chris
> You should use the input() function (called raw_input() in Python 2)
> for a user name, and the getpass module for the password:
i have just tried:
# Give user the file requested
url = "http://superhost.gr/data/files/%s" % realfile
username = getpass.getuser()
password = getpass.getpass()
r = requests.get( url, auth = (username, password) )# ask user for authentication data
r.raise_for_status()
More information about the Python-list
mailing list