File: http_basic_auth.py

package info (click to toggle)
python-zeep 4.3.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,600 kB
  • sloc: python: 15,551; makefile: 13
file content (18 lines) | stat: -rw-r--r-- 426 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from requests import Session
from requests.auth import HTTPBasicAuth

import zeep
from zeep.transports import Transport

# Example using basic authentication with a webservice

session = Session()
session.auth = HTTPBasicAuth('username', 'password')
transport_with_basic_auth = Transport(session=session)

client = zeep.Client(
    wsdl='http://nonexistent?WSDL',
    transport=transport_with_basic_auth
)

client.wsdl.dump()