![]() Server : Apache/2.4.52 (Ubuntu) System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64 User : www-data ( 33) PHP Version : 8.1.2-1ubuntu2.21 Disable Function : NONE Directory : /lib/python3/dist-packages/lazr/restfulclient/authorize/__pycache__/ |
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� d�ZG d d� d�ZG dd� dej�ZG dd� de�ZG dd� de�ZdS )z.OAuth classes for use with lazr.restfulclient.� )�ConfigParser)�SafeConfigParserN)�oauth1)�parse_qs� urlencode)�HttpAuthorizer)�CredentialsFileError)�AccessToken�Consumer�OAuthAuthorizer�SystemWideConsumer�1c @ s e Zd ZdZddd�ZdS )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)�key�secret�application_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 dd�Zdd� 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| jfg�S )N�oauth_token_secret�oauth_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 )�cls�s�paramsr 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 z�A 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 )z�The 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 )�distro�name� Exception�platform�system� KEY_FORMAT�socket�gethostname)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 ddd�Zedd� �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_token�oauth_realm)r � consumer_name�consumer_secretr<