Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/libcloud/common/__pycache__/nfsn.cpython-39.pyc
Ðазад
a q�h) � @ s� d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlmZm Z d dl mZmZm Z ejej ZG dd� de �ZG dd � d e�ZG d d� de�ZdS )� N)�ConnectionUserAndKey)�JsonResponse)�InvalidCredsError� ProviderError)� basestring�httplib� urlencodec s e Zd Zd� fdd� Z� ZS )� NFSNExceptionNc s || _ tt| ��|||� d S �N)�code�superr �__init__)�self�valueZ http_coder Zdriver�� __class__� ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/libcloud/common/nfsn.pyr s zNFSNException.__init__)N)�__name__� __module__�__qualname__r � __classcell__r r r r r s r c @ s e Zd Zdd� ZdS )�NFSNResponsec C s� | j tjkrtd��| �� }t|t�r4|d| j S |�dd �}|�dd �}d}|d ur\|}|d urh|}|d ur�|d ur�|d | }|d| j }|S )NzInvalid provider credentialsz (HTTP Code: %d)�error�debugzNo message specified� )�statusr �UNAUTHORIZEDr Z parse_body� isinstancer �get)r �bodyr r r r r r �parse_error% s zNFSNResponse.parse_errorN)r r r r! r r r r r # s r c @ sB e Zd ZdZeZdZdd� Zddd �Zd d� Z dd � Z dd� ZdS )�NFSNConnectionzapi.nearlyfreespeech.netFc C st | j }| �� }| �� }| j}t|�}t�|�d���� }d� ||||||f�}t�|�d���� } d� |||| f�S )z� Build the contents of the X-NFSN-Authentication HTTP header. See https://members.nearlyfreespeech.net/wiki/API/Introduction for more explanation. zutf-8�;) Zuser_id� _timestamp�_salt�keyr �hashlib�sha1�encode� hexdigest�join) r �action�data�login� timestamp�saltZapi_keyZ data_hash�stringZstring_hashr r r �_headerC s zNFSNConnection._headerN� �GETc C sH |si }|si }| � ||�}||d<