U
    kufJ                     @   s.   d dl Z ddlmZ ddlmZ dddZdS )	    N   )	HTTPError)json2packagehttps://pypi.python.org/pypi/c                 C   sf   | ds|d }td|| }|jdkr>t|j|jdt|jdrXt	|j
 S t	|jS dS )aC  
    Constructs a request to the PyPI server and returns a
    :class:`yarg.package.Package`.

    :param package_name: case sensitive name of the package on the PyPI server.
    :param pypi_server: (option) URL to the PyPI server.

        >>> import yarg
        >>> package = yarg.get('yarg')
        <Package yarg>
    /z{0}{1}/jsoni,  )status_codereasondecodeN)endswithrequestsgetformatr   r   r   hasattrcontentr   r	   )package_nameZpypi_serverresponse r   //tmp/pip-unpacked-wheel-pz57x_63/yarg/client.pyr       s    


r   )r   )r   
exceptionsr   packager   r   r   r   r   r   <module>   s   