Skip to content
Myr

initial auth module w/ httpbasic auth

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Kenneth Reitz · committed by Kenneth Reitz · parent b8d4a5e · Browse files · 1 file+29 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+29 added−0 removed

  • other:+29 added−0 removed

1 file+29 added−0 removed

added:requests/auth.py+29 added
1# -*- coding: utf-8 -*-23"""4requests.auth5~~~~~~~~~~~~~67This module contains the authentication handlers for Requests.8"""910from base64 import encodestring as base641112def http_basic(r, username, password):13 """Attaches HTTP Basic Authentication to the given Request object.14 Arguments should be considered non-positional.1516 """1718 auth_s = base64('%s:%s' % (username, password)).replace('\n', '')19 r.headers['Authorization'] = ('Basic %s' % auth_s)2021 return r222324def http_digest(r, username, password):25 """Attaches HTTP Digest Authentication to the given Request object.26 Arguments should be considered non-positional.27 """2829 r.headers