Skip to main content

This package patches requests at runtime to authenticate with kerberos proxy (negotiate)

Project description

kerberos-proxy-auth

This package patches requests and urllib3 at runtime to authenticate with kerberos proxy (spnego)

Installation

a) using a NON-kerberos proxy (if available)

  1. set the environment variables to NON-kerberos proxy and use pip install ...
    set https_proxy=http://<NONkerberosproxy>:8080
    set http_proxy=http://<NONkerberosproxy>:8080
    pip install kerberos-proxy-auth
    

b) from behind the kerberos proxy

  1. download this package manually as well as all its dependancies.
  2. run this command
    pip install path/to/kerberos-proxy-auth-main.zip path/to/dependancy1.zip path/to/dependancy2.zip [...]
    

Usage

After installation

  1. set the environment variables
    set https_proxy=http://<kerberosproxy>:8080
    set http_proxy=http://<kerberosproxy>:8080
    
  2. start python and use requests, urllib3 or pip even from behind the kerberos proxy without any further action.
    import requests
    r = requests.get('https://example.org')
    print(r.status_code)
    # expected: 200
    
    r = requests.head('https://example.org')
    print(r.status_code)
    # expected: 200
    
    r = requests.request('GET', 'https://example.org')
    print(r.status_code)
    # expected : 200
    
    import urllib3, os
    http = urllib3.poolmanager.proxy_from_url(os.getenv('https_proxy'))
    r = http.request('GET', 'https://example.org')
    print(r.status)
    # expected : 200
    

ToDo

  • test, feedback, contribute improvements
  • rework to support other environments (currently only: windows/system)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kerberos-proxy-auth-0.0.2.tar.gz (4.3 kB view hashes)

Uploaded Source

Built Distribution

kerberos_proxy_auth-0.0.2-py3-none-any.whl (6.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page