o
    ‹¨Êhy  ã                   @   s„   d Z ddlmZ ddlmZ ddlmZmZ ddlm	Z	 ddl
mZ dZd	d
ddddddedddddiZG dd„ deƒZdd„ ZdS )z¼
    pyexcel.plugins.sources.http
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Representation of http sources

    :copyright: (c) 2015-2017 by Onni Software Ltd.
    :license: New BSD License
é    N)ÚAbstractSource)ÚPY2Úrequest)ÚPARSERé   )ÚparamszAapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheetztext/csvÚcsvztext/tab-separated-valuesÚtsvz.application/vnd.oasis.opendocument.spreadsheetÚodszapplication/vnd.ms-excelÚxlsÚxlsxz.application/vnd.ms-excel.sheet.macroenabled.12Úxlsmz	text/htmlÚhtmlc                   @   sT   e Zd ZdZejgZejej	fZ
ejfZejgZejZd	dd„Zdd„ Zdd„ ZdS )
Ú
HttpSourcez6
    Multiple sheet data source via http protocol
    Nc                 K   s   || _ tj| fi |¤Ž d S ©N)Ú_HttpSource__urlr   Ú__init__)ÚselfÚurlÚkeywords© r   úN/var/www/html/env/lib/python3.10/site-packages/pyexcel/plugins/sources/http.pyr   )   s   zHttpSource.__init__c                 C   sx   t  | j¡}| ¡ }tr|j}n| ¡ }t |d ¡}|d u r#t	| jƒ}| j
 dd ¡}t ||¡}|j|fi | j
¤Ž}|S )NÚparser_library)r   Úurlopenr   Úinfor   ÚtypeÚget_content_typeÚFILE_TYPE_MIME_TABLEÚgetÚ_get_file_type_from_urlÚ	_keywordsr   Úget_a_pluginÚparse_file_stream)r   Ú
connectionr   Ú	mime_typeÚ	file_typer   ÚaparserÚsheetsr   r   r   Úget_data-   s   
zHttpSource.get_datac                 C   s
   | j d fS r   )r   )r   r   r   r   Úget_source_info<   s   
zHttpSource.get_source_infor   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚURLÚfieldsÚ	constantsÚSHEETÚBOOKÚtargetsÚREAD_ACTIONÚactionsÚ
attributesÚkeyr   r(   r)   r   r   r   r   r      s    
r   c                 C   s   |   d¡}|d S )NÚ.éÿÿÿÿ)Úsplit)r   Ú	extensionr   r   r   r   @   s   
r   )r-   Úpyexcel.constantsr0   Úpyexcel.sourcer   Úpyexcel._compactr   r   Úpyexcel.internalr   Ú r   ÚXLSXr   r   r   r   r   r   r   Ú<module>   s"    	ù"