telegram.request.RequestData#
- class telegram.request.RequestData(parameters=None)[source]#
Bases:
object
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.
New in version 20.0.
Warning
How exactly instances of this will 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.
- contains_files[source]#
Whether this object contains files to be uploaded via
multipart/form-data
.- Type
- property json_parameters[source]#
Gives the parameters as mapping of parameter name to the respective JSON encoded value.
- property multipart_data[source]#
Gives the files contained in this object as mapping of part name to encoded content.
- property parameters[source]#
Gives the parameters as mapping of parameter name to the parameter value, which can be a single object of type
int
,float
,str
orbool
or any (possibly nested) composition of lists, tuples and dictionaries, where each entry, key and value is of one of the mentioned types.
- parametrized_url(url, encode_kwargs=None)[source]#
Shortcut for attaching the return value of
url_encoded_parameters()
to theurl
.- Parameters
encode_kwargs (Dict[
str
, any], optional) – Additional keyword arguments to pass along tourllib.parse.urlencode()
.
- url_encoded_parameters(encode_kwargs=None)[source]#
Encodes the parameters with
urllib.parse.urlencode()
.- Parameters
encode_kwargs (Dict[
str
, any], optional) – Additional keyword arguments to pass along tourllib.parse.urlencode()
.