Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(4)  |  Call(4)  |  Derive(0)  |  Import(0)

src/w/i/wille-2.3/tests/http_exec.py   wille(Download)
# HTTP GET with HTTP Basic Authentication
if debug: print("HTTP GET + Basic Auth")
cl.keyring.add_token_username('validusername', 'validpassword', 'localhost:8080')
resp = cl.execute_service(uri='http://localhost:8080/httpbasic')
assert( resp.data == VALID_RESPONSE )
 
# HTTP GET with HTTP Basic Authentication and 2 invalid usernames/passwords (1 of each)
if debug: print("HTTP GET + multichoice Basic Auth")
cl2 = Client()
cl2.keyring.add_token_username('invalidusername', 'validpassword', 'localhost:8080/httpbasic')
cl2 = Client()
cl2.keyring.add_token_username('invalidusername', 'validpassword', 'localhost:8080/httpbasic')
cl2.keyring.add_token_username('validusername', 'invalidpassword', 'localhost:8080/httpbasic')
cl2.keyring.add_token_username('validusername', 'validpassword', 'localhost:8080')
assert( cl2.execute_service(uri='http://localhost:8080/httpbasic').data == VALID_RESPONSE )