�
ӵ Yc @ se d d l Z d d l Z d d l Z d d � Z d e f d � � YZ d � Z d � Z d � Z d S( i����Nc C s= | d k r g } n t | | � 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( t Nonet UserAgentBuildert include_extrast include_implementationt include_systemt build( t namet versiont extras( ( sF /usr/lib/python2.7/site-packages/requests_toolbelt/utils/user_agent.pyt
user_agent s
R c B sA e Z d Z d Z d � Z d � Z d � Z d � Z d � Z RS( 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/%sc C s t j | | f g � | _ d S( 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( t collectionst dequet _pieces( t selfR R ( ( sF /usr/lib/python2.7/site-packages/requests_toolbelt/utils/user_agent.pyt __init__4 s c C s* d j g | j D] } | j | ^ q � S( s� Finalize the User-Agent string.
:returns:
Formatted User-Agent string.
:rtype:
str
t ( t joinR t
format_string( R
t piece( ( sF /usr/lib/python2.7/site-packages/requests_toolbelt/utils/user_agent.pyR >