← Back
Editing: credentials.cpython-38.pyc
U �v�^Hx � @ s� d dl mZ eZdddddddgZzd d lmZ W n ek rR d d lmZ Y nX d d l Z d d l Z d dlmZ d d lZd dl mZ d d lZzd d lmZ W n ek r� d d lmZ Y nX zd dlmZ W n ek r� d dlmZ Y nX d d lZd dlmZmZ zd d lZW n ek �r2 d d lZY nX d dlmZ eek�rPeZ neZ d dl!m"Z" d dl#m$Z%m&Z&m'Z'm(Z( d dl)m*Z* dZ+dZ,dZ-dZ.dZ/e0e1e2fZ3dd� Z4dd� Z5G dd� de'�Z6G dd� de%�Z$G dd� de%�Z7G d d� de8�Z9G d!d"� d"e9�Z:G d#d$� d$e9�Z;G d%d&� d&e9�Z<G d'd� de8�Z=G d(d)� d)e=�Z>G d*d� de>�Z?G d+d,� d,e@�ZAG d-d.� d.eA�ZBG d/d0� d0eA�ZCG d1d2� d2eC�ZDG d3d4� d4eC�ZEG d5d6� d6eE�ZFG d7d8� d8eA�ZGG d9d:� d:eA�ZHG d;d<� d<eA�ZIG d=d>� d>eA�ZJd S )?� )�print_function�AccessToken�AnonymousAccessToken� AuthorizeRequestTokenWithBrowser�CredentialStore�RequestTokenAuthorizationEngine�Consumer�Credentials)�StringION)�select)�stdin)� urlencode)�urljoin)� b64decode� b64encode)�parse_qs)� HTTPError)r r �OAuthAuthorizer�SystemWideConsumer)�urisz+request-tokenz +access-tokenz+authorize-token� i� c C s t tj�dd��S )z�Whether the user has disabled SSL certificate connection. Some testing servers have broken certificates. Rather than raising an error, we allow an environment variable, ``LP_DISABLE_SSL_CERTIFICATE_VALIDATION`` to disable the check. Z%LP_DISABLE_SSL_CERTIFICATE_VALIDATIONF)�bool�os�environ�get� r r �:/usr/lib/python3/dist-packages/launchpadlib/credentials.py�$_ssl_certificate_validation_disabledY s �r c C sD t � }tj|d�j| d|t|�d�\}}|jdkr<t||��||fS )z�POST to ``url`` with ``headers`` and a body of urlencoded ``params``. Wraps it up to make sure we avoid the SSL certificate validation if our environment tells us to. Also, raises an error on non-200 statuses. )Z"disable_ssl_certificate_validationZPOST)�method�headersZbody�� )r �httplib2ZHttpZrequestr �statusr )�urlr �paramsZ cert_disabled�response�contentr r r � _http_postg s � � r'