/usr/lib/python3/dist-packages/lazr/restfulclient/authorize/__pycache__
Edit: /usr/lib/python3/dist-packages/lazr/restfulclient/authorize/__pycache__/oauth.cpython-310.pyc (8586B)
o
.^V( @ s d Z zddlmZ W n ey ddlmZ Y nw ddlZddlZddlZddlZddl m
Z
ddlZddlm
Z
mZ ddlmZ ddlmZ eZg d Zd
ZG dd dZG d
d dZG dd dejZG dd deZG dd deZdS )z.OAuth classes for use with lazr.restfulclient. )ConfigParser)SafeConfigParserN)oauth1)parse_qs urlencode)HttpAuthorizer)CredentialsFileError)AccessTokenConsumerOAuthAuthorizerSystemWideConsumer1c @ s e Zd ZdZdddZdS )r
z An OAuth consumer (application). Nc C s || _ || _|| _dS )an Initialize
:param key: The OAuth consumer key
:param secret: The OAuth consumer secret. Don't use this. It's
a misfeature, and lazr.restful doesn't expect it.
:param application_name: An application name, if different
from the consumer key. If present, this will be used in
the User-Agent header.
N)keysecretapplication_name)selfr r r r D/usr/lib/python3/dist-packages/lazr/restfulclient/authorize/oauth.py__init__; s
zConsumer.__init__r N)__name__
__module____qualname____doc__r r r r r r
8 s r
c @ s2 e Zd ZdZd
ddZdd ZeZedd ZdS )r zAn OAuth access token.r Nc C s || _ || _|| _d S N)r r context)r r r r r r r r M s
zAccessToken.__init__c C s t d| jfd| jfgS )Noauth_token_secretoauth_token)r r r r r r r to_stringR s zAccessToken.to_stringc C s. t |dd}|d d }|d d }| ||S )NF)keep_blank_valuesr r r )r )clssparamsr r r r r from_stringZ s
zAccessToken.from_stringr ) r r r r r r __str__classmethodr% r r r r r J s
r c @ s e Zd ZdZdd ZeZdS )TruthyStringz&A Unicode string which is always true.c C s dS )NTr r r r r __bool__e s zTruthyString.__bool__N)r r r r r) __nonzero__r r r r r( b s r( c s2 e Zd ZdZdZd fdd Zedd Z ZS ) r zA consumer associated with the logged-in user rather than an app.
This can be used to share a single OAuth token among multiple
desktop applications. The OAuth consumer key will be derived from
system information (platform and hostname).
zSystem-wide: %s (%s)r c s t t| | j|| dS )a Constructor.
:param application_name: An application name. This will be
used in the User-Agent header.
:param secret: The OAuth consumer secret. Don't use this. It's
a misfeature, and lazr.restful doesn't expect it.
N)superr r consumer_key)r r r __class__r r r t s
zSystemWideConsumer.__init__c C sN z
ddl }| }W n ty d}Y nw |dkrt }| j|t f S )zThe system-wide OAuth consumer key for this computer.
This key identifies the platform and the computer's
hostname. It does not identify the active user.
r Nr )distroname Exceptionplatformsystem
KEY_FORMATsocketgethostname)r r/ distnamer r r r, s zSystemWideConsumer.consumer_key)r ) r r r r r4 r propertyr,
__classcell__r r r- r r k s r c @ sX e Zd ZdZ dddZedd Zd d
Zedd Z d
d Z
dd Zdd ZdS )r zBA client that signs every outgoing request with OAuth credentials.Nr OAuthc C s, d | _ |d urt|||| _ || _|| _d S r )consumerr
access_tokenoauth_realm)r
consumer_nameconsumer_secretr<