"Fossies" - the Fresh Open Source Software Archive

Member "mod_auth_gssapi-1.6.3/tests/t_basic_proxy.py" (15 May 2020, 849 Bytes) of package /linux/www/apache_httpd_modules/mod_auth_gssapi-1.6.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "t_basic_proxy.py": 1.6.2_vs_1.6.3.

    1 #!/usr/bin/env python
    2 # Copyright (C) 2015 - mod_auth_gssapi contributors, see COPYING for license.
    3 
    4 import os
    5 
    6 import requests
    7 from requests.auth import HTTPBasicAuth
    8 
    9 
   10 if __name__ == '__main__':
   11     proxy = 'http://%s:%s@%s:%s' % (os.environ['MAG_USER_NAME'],
   12                                     os.environ['MAG_USER_PASSWORD'],
   13                                     os.environ['NSS_WRAPPER_HOSTNAME'],
   14                                     os.environ['WRAP_PROXY_PORT'])
   15     proxies = {"http": proxy, }
   16     url = 'http://%s/basic_auth_krb5/' % os.environ['NSS_WRAPPER_HOSTNAME']
   17     r = requests.get(url, proxies=proxies,
   18                      auth=HTTPBasicAuth(os.environ['MAG_USER_NAME_2'],
   19                                         os.environ['MAG_USER_PASSWORD_2']))
   20     if r.status_code != 200:
   21         raise ValueError('Basic Proxy Auth Failed')