Python3 using requests to grab HTTP Auth Data

Νίκος Βέργος me.on.nzt at gmail.com
Wed Feb 1 15:51:52 EST 2017


Τη Τετάρτη, 1 Φεβρουαρίου 2017 - 9:22:46 μ.μ. UTC+2, ο χρήστης Chris Angelico έγραψε:
> 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() 
===============================

as well as input() for both user & pass combo but iam not getting in chrome the basic pop-up HTTP auth window.

Any idea why?



More information about the Python-list mailing list