L ivdZddlZddlmZmZmZmZddlmZddl m Z ddl m Z ddl mZeGdd Zy) zSThis module contains a class that holds the parameters of a request to the Bot API.N)AnyOptionalUnionfinal) urlencode) TextEncoding)UploadFileDict)RequestParameterc eZdZdZdZddeeefdZe de e e e e eee eeffffdZe de e e ffdZdd ee e efde fd Zdd e d ee e efde fd Ze defd Ze defdZy) RequestDataa?Instances of this class collect the data needed for one request to the Bot API, including all parameters and files to be sent along with the request. .. versionadded:: 20.0 Warning: How exactly instances of this are created should be considered an implementation detail and not part of PTBs public API. Users should exclusively rely on the documented attributes, properties and methods. Attributes: contains_files (:obj:`bool`): Whether this object contains files to be uploaded via ``multipart/form-data``. ) _parameterscontains_filesN parametersc\|xsg|_td|jD|_y)Nc34K|]}|jywN) input_files).0params c/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/telegram/request/_requestdata.py z'RequestData.__init__..3s'Xe(9(9'Xs)r anyr)selfrs r__init__zRequestData.__init__1s(3=3C$''XtGWGW'X$Xreturnc|jDcic]%}|j|j|j'c}Scc}w)aGives the parameters as mapping of parameter name to the parameter value, which can be a single object of type :obj:`int`, :obj:`float`, :obj:`str` or :obj:`bool` or any (possibly nested) composition of lists, tuples and dictionaries, where each entry, key and value is of one of the mentioned types. Returns: dict[:obj:`str`, Union[:obj:`str`, :obj:`int`, list[any], dict[any, any]]] )r valuenamerrs rrzRequestData.parameters5sA)) {{& JJ #   *<c|jDcic]%}|j|j|j'c}Scc}w)aGives the parameters as mapping of parameter name to the respective JSON encoded value. Tip: By default, this property uses the standard library's :func:`json.dumps`. To use a custom library for JSON encoding, you can directly encode the keys of :attr:`parameters` - note that string valued keys should not be JSON encoded. Returns: dict[:obj:`str`, :obj:`str`] )r json_valuerr s rjson_parameterszRequestData.json_parametersEsE)) + JJ(( (   r! encode_kwargsc\|rt|jfi|St|jS)aEncodes the parameters with :func:`urllib.parse.urlencode`. Args: encode_kwargs (dict[:obj:`str`, any], optional): Additional keyword arguments to pass along to :func:`urllib.parse.urlencode`. Returns: :obj:`str` )rr$)rr%s rurl_encoded_parametersz"RequestData.url_encoded_parametersXs. T11C]C C--..rurlc4|j|}|d|S)aShortcut for attaching the return value of :meth:`url_encoded_parameters` to the :paramref:`url`. Args: url (:obj:`str`): The URL the parameters will be attached to. encode_kwargs (dict[:obj:`str`, any], optional): Additional keyword arguments to pass along to :func:`urllib.parse.urlencode`. Returns: :obj:`str` )r%?)r')rr(r%url_parameterss rparametrized_urlzRequestData.parametrized_urlfs)44=4Qa'((rcztj|jjtj S)aThe :attr:`parameters` as UTF-8 encoded JSON payload. Tip: By default, this property uses the standard library's :func:`json.dumps`. To use a custom library for JSON encoding, you can directly encode the keys of :attr:`parameters` - note that string valued keys should not be JSON encoded. Returns: :obj:`bytes` )jsondumpsr$encoderUTF_8)rs r json_payloadzRequestData.json_payloadus*zz$../66|7I7IJJrcli}|jD]"}|j}|s|j|$|S)zGives the files contained in this object as mapping of part name to encoded content. .. versionchanged:: 21.5 Content may now be a file handle. )r multipart_dataupdate)rr4rm_datas rr4zRequestData.multipart_datasB*,%% .E))F%%f- .rr)__name__ __module__ __qualname____doc__ __slots__rlistr rpropertydictstrrintrrr$r'r,bytesr2r r4rrr r s  2IY8D1A,B#CY  DeCd3ic3h,O&P!PQ     c3h  $ /HT#s(^4L /X[ / )C )c3h8P )\_ ) Ke K K   rr )r:r.typingrrrr urllib.parsertelegram._utils.stringsrtelegram._utils.typesr "telegram.request._requestparameterr r rBrrrHs<&Z .."00?pppr