Spade
Mini Shell
| Directory:~$ /lib/python2.7/site-packages/requests_toolbelt/utils/ |
| [Home] [System Details] [Kill Me] |
�
ӵ
Yc@seddlZddlZddlZdd�Zdefd��YZd�Zd�Zd�Z dS(i����NcCs=|dkrg}nt||�j|�j�j�j�S(s�Return
an internet-friendly user_agent string.
The majority of this code has been wilfully stolen from the equivalent
function in Requests.
:param name: The intended name of the user-agent, e.g.
"python-requests".
:param version: The version of the user-agent, e.g. "0.0.1".
:param extras: List of two-item tuples that are added to the user-agent
string.
:returns: Formatted user-agent string
:rtype: str
N(tNonetUserAgentBuildertinclude_extrastinclude_implementationtinclude_systemtbuild(tnametversiontextras((sF/usr/lib/python2.7/site-packages/requests_toolbelt/utils/user_agent.pyt
user_agents
RcBsAeZdZdZd�Zd�Zd�Zd�Zd�ZRS(s�Class
to provide a greater level of control than :func:`user_agent`.
This is used by :func:`user_agent` to build its User-Agent string.
.. code-block:: python
user_agent_str = UserAgentBuilder(
name='requests-toolbelt',
version='17.4.0',
).include_implementation(
).include_system(
).include_extras([
('requests', '2.14.2'),
('urllib3', '1.21.2'),
]).build()
s%s/%scCstj||fg�|_dS(s�Initialize our builder with
the name and version of our user agent.
:param str name:
Name of our user-agent.
:param str version:
The version string for user-agent.
N(tcollectionstdequet_pieces(tselfRR((sF/usr/lib/python2.7/site-packages/requests_toolbelt/utils/user_agent.pyt__init__4scCs*djg|jD]}|j|^q�S(s�Finalize
the User-Agent string.
:returns:
Formatted User-Agent string.
:rtype:
str
t
(tjoinRt
format_string(R
tpiece((sF/usr/lib/python2.7/site-packages/requests_toolbelt/utils/user_agent.pyR>scCs9td�|D��r%td��n|jj|�|S(s�Include
extra portions of the User-Agent.
:param list extras:
list of tuples of extra-name and extra-version
css!|]}t|�dkVqdS(iN(tlen(t.0textra((sF/usr/lib/python2.7/site-packages/requests_toolbelt/utils/user_agent.pys <genexpr>Nss/Extras
should be a sequence of two item tuples.(tanyt
ValueErrorRtextend(R
R((sF/usr/lib/python2.7/site-packages/requests_toolbelt/utils/user_agent.pyRHscCs|jjt��|S(s�Append
the implementation string to the user-agent string.
This adds the the information that you're using CPython 2.7.13
to the
User-Agent.
(Rtappendt_implementation_tuple(R
((sF/usr/lib/python2.7/site-packages/requests_toolbelt/utils/user_agent.pyRTscCs|jjt��|S(s2Append
the information about the Operating
System.(RRt_platform_tuple(R
((sF/usr/lib/python2.7/site-packages/requests_toolbelt/utils/user_agent.pyR]s( t__name__t
__module__t__doc__RRRRRR(((sF/usr/lib/python2.7/site-packages/requests_toolbelt/utils/user_agent.pyRs
cCs�tj�}|dkr'tj�}n�|dkr�dtjjtjjtjjf}tjjdkr�dj |tjjg�}q�n<|dkr�tj�}n!|dkr�tj�}nd}||fS( s�Return
the tuple of interpreter name and version.
Returns a string that provides both the name and the version of the
Python
implementation currently running. For example, on CPython 2.7.5 it will
return "CPython/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.
tCPythontPyPys%s.%s.%stfinalttJythont
IronPythontUnknown(
tplatformtpython_implementationtpython_versiontsystpypy_version_infotmajortminortmicrotreleaselevelR(timplementationtimplementation_version((sF/usr/lib/python2.7/site-packages/requests_toolbelt/utils/user_agent.pyRcs
cCsdt�S(Ns%s/%s(R(((sF/usr/lib/python2.7/site-packages/requests_toolbelt/utils/user_agent.pyt_implementation_string�scCsFytj�}tj�}Wntk
r;d}d}nX||fS(NR%(R&tsystemtreleasetIOError(tp_systemt p_release((sF/usr/lib/python2.7/site-packages/requests_toolbelt/utils/user_agent.pyR�s
(
R
R&R)RR tobjectRRR1R(((sF/usr/lib/python2.7/site-packages/requests_toolbelt/utils/user_agent.pyt<module>sD !