mirror of
https://github.com/httpie/cli.git
synced 2024-11-28 02:33:27 +01:00
27 lines
538 B
Python
27 lines
538 B
Python
|
import requests.auth
|
||
|
|
||
|
from .base import AuthPlugin
|
||
|
|
||
|
|
||
|
class BuiltinAuthPlugin(AuthPlugin):
|
||
|
|
||
|
package_name = '(builtin)'
|
||
|
|
||
|
|
||
|
class BasicAuthPlugin(BuiltinAuthPlugin):
|
||
|
|
||
|
name = 'Basic HTTP auth'
|
||
|
auth_type = 'basic'
|
||
|
|
||
|
def get_auth(self, username, password):
|
||
|
return requests.auth.HTTPBasicAuth(username, password)
|
||
|
|
||
|
|
||
|
class DigestAuthPlugin(BuiltinAuthPlugin):
|
||
|
|
||
|
name = 'Digest HTTP auth'
|
||
|
auth_type = 'digest'
|
||
|
|
||
|
def get_auth(self, username, password):
|
||
|
return requests.auth.HTTPDigestAuth(username, password)
|