
º|j»  ã               @   s  d  Z  d d l m Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l	 Z	 d d l
 m Z y d d l m Z Wn$ e k
 r´ d Z d Z d Z Yn Xd d l Z d d l Z d d „  Z d	 d
 „  Z d d „  Z e d k re ƒ  d S)z'Module containing bug report helper(s).é    )Úprint_functionNé   )Ú__version__)Ú	pyopensslc              C   sÔ   t  j ƒ  }  |  d k r' t  j ƒ  } n� |  d k rˆ d t j j t j j t j j f } t j j d k rÄ d j	 | t j j g ƒ } n< |  d k r£ t  j ƒ  } n! |  d k r¾ t  j ƒ  } n d } d	 |  d
 | i S)a×  Return a dict with the Python implementation and version.

    Provide both the name and the version of the Python implementation
    currently running. For example, on CPython 2.7.5 it will return
    {'name': 'CPython', 'version': '2.7.5'}.

    This function works best on CPython and PyPy: in particular, it probably
    doesn't work for Jython or IronPython. Future investigation should be done
    to work out the correct shape of the code for those platforms.
    ÚCPythonÚPyPyz%s.%s.%sÚfinalÚ ÚJythonÚ
IronPythonÚUnknownÚnameÚversion)
ÚplatformÚpython_implementationÚpython_versionÚsysÚpypy_version_infoÚmajorÚminorÚmicroÚreleaselevelÚjoin)ÚimplementationÚimplementation_version© r   ú1/tmp/pip-build-1hwfuv5s/requests/requests/help.pyÚ_implementation   s     	r   c        	      C   sN  y" d t  j ƒ  d t  j ƒ  i }  Wn$ t k
 rH d d d d i }  Yn Xt ƒ  } d t j i } d t j i } d d d d i } t r§ d t j d d t j	 j
 i } d t t d	 d ƒ i } d t t d	 d ƒ i } t j
 } d | d k	 rù d | n d i } d
 |  d | d | d t d k	 d | d | d | d | d | d d t i i
 S)z&Generate information for a bug report.ÚsystemÚreleaser   r   NÚopenssl_versionr	   z%xr   r   r   Ú
system_sslZusing_pyopensslZ	pyOpenSSLÚurllib3ÚchardetÚcryptographyÚidnaÚrequests)r   r   r   ÚIOErrorr   r"   r   r#   ÚOpenSSLZSSLÚOPENSSL_VERSION_NUMBERÚgetattrr$   r%   Ússlr   Úrequests_version)	Zplatform_infoZimplementation_infoZurllib3_infoZchardet_infoZpyopenssl_infoZcryptography_infoZ	idna_infor!   Zsystem_ssl_infor   r   r   Úinfo;   s:    			"r-   c               C   s&   t  t j t ƒ  d d d d ƒƒ d S)z)Pretty-print the bug information as JSON.Ú	sort_keysTÚindenté   N)ÚprintÚjsonÚdumpsr-   r   r   r   r   Úmainq   s    r4   Ú__main__)Ú__doc__Ú
__future__r   r2   r   r   r+   r%   r"   r#   r	   r   r,   Zurllib3.contribr   ÚImportErrorr(   r$   r   r-   r4   Ú__name__r   r   r   r   Ú<module>   s,   !6