@@ -109,8 +109,8 @@ class Bot(TelegramObject):
109109 base_file_url (:obj:`str`, optional): Telegram Bot API file URL.
110110 request (:obj:`telegram.utils.request.Request`, optional): Pre initialized
111111 :obj:`telegram.utils.request.Request`.
112- private_key (:obj:`bytes`): Private key for decryption of telegram passport data.
113- private_key_password (:obj:`bytes`): Password for above private key.
112+ private_key (:obj:`bytes`, optional ): Private key for decryption of telegram passport data.
113+ private_key_password (:obj:`bytes`, optional ): Password for above private key.
114114
115115 """
116116
@@ -131,15 +131,10 @@ def __init__(self, token, base_url=None, base_file_url=None, request=None, priva
131131 self .logger = logging .getLogger (__name__ )
132132
133133 if private_key :
134- if not CRYPTO :
135- raise ValueError ('private_key given, but no crypto library found. Try pip '
136- 'install cryptography before proceeding.' )
137- else :
138- self .private_key = serialization .load_pem_private_key (
139- private_key ,
140- password = private_key_password ,
141- backend = default_backend ()
142- )
134+ self .private_key = serialization .load_pem_private_key (private_key ,
135+ password = private_key_password ,
136+ backend = default_backend ()
137+ )
143138
144139 @property
145140 def request (self ):
@@ -403,7 +398,7 @@ def send_photo(self,
403398
404399 if isinstance (photo , PhotoSize ):
405400 photo = photo .file_id
406- if InputFile .is_file (photo ):
401+ elif InputFile .is_file (photo ):
407402 photo = InputFile (photo )
408403
409404 data = {'chat_id' : chat_id , 'photo' : photo }
@@ -465,7 +460,7 @@ def send_audio(self,
465460 reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options. A
466461 JSON-serialized object for an inline keyboard, custom reply keyboard, instructions
467462 to remove reply keyboard or to force a reply from the user.
468- thumb (`filelike object`): Thumbnail of the
463+ thumb (`filelike object`, optional ): Thumbnail of the
469464 file sent. The thumbnail should be in JPEG format and less than 200 kB in size.
470465 A thumbnail's width and height should not exceed 90. Ignored if the file is not
471466 is passed as a string or file_id.
@@ -483,7 +478,7 @@ def send_audio(self,
483478
484479 if isinstance (audio , Audio ):
485480 audio = audio .file_id
486- if InputFile .is_file (audio ):
481+ elif InputFile .is_file (audio ):
487482 audio = InputFile (audio )
488483
489484 data = {'chat_id' : chat_id , 'audio' : audio }
@@ -547,7 +542,7 @@ def send_document(self,
547542 reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options. A
548543 JSON-serialized object for an inline keyboard, custom reply keyboard, instructions
549544 to remove reply keyboard or to force a reply from the user.
550- thumb (`filelike object`): Thumbnail of the
545+ thumb (`filelike object`, optional ): Thumbnail of the
551546 file sent. The thumbnail should be in JPEG format and less than 200 kB in size.
552547 A thumbnail's width and height should not exceed 90. Ignored if the file is not
553548 is passed as a string or file_id.
@@ -565,7 +560,7 @@ def send_document(self,
565560
566561 if isinstance (document , Document ):
567562 document = document .file_id
568- if InputFile .is_file (document ):
563+ elif InputFile .is_file (document ):
569564 document = InputFile (document , filename = filename )
570565
571566 data = {'chat_id' : chat_id , 'document' : document }
@@ -626,7 +621,7 @@ def send_sticker(self,
626621
627622 if isinstance (sticker , Sticker ):
628623 sticker = sticker .file_id
629- if InputFile .is_file (sticker ):
624+ elif InputFile .is_file (sticker ):
630625 sticker = InputFile (sticker )
631626
632627 data = {'chat_id' : chat_id , 'sticker' : sticker }
@@ -683,7 +678,7 @@ def send_video(self,
683678 reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options. A
684679 JSON-serialized object for an inline keyboard, custom reply keyboard, instructions
685680 to remove reply keyboard or to force a reply from the user.
686- thumb (`filelike object`): Thumbnail of the
681+ thumb (`filelike object`, optional ): Thumbnail of the
687682 file sent. The thumbnail should be in JPEG format and less than 200 kB in size.
688683 A thumbnail's width and height should not exceed 90. Ignored if the file is not
689684 is passed as a string or file_id.
@@ -701,7 +696,7 @@ def send_video(self,
701696
702697 if isinstance (video , Video ):
703698 video = video .file_id
704- if InputFile .is_file (video ):
699+ elif InputFile .is_file (video ):
705700 video = InputFile (video )
706701
707702 data = {'chat_id' : chat_id , 'video' : video }
@@ -761,7 +756,7 @@ def send_video_note(self,
761756 reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options. A
762757 JSON-serialized object for an inline keyboard, custom reply keyboard,
763758 instructions to remove reply keyboard or to force a reply from the user.
764- thumb (`filelike object`): Thumbnail of the
759+ thumb (`filelike object`, optional ): Thumbnail of the
765760 file sent. The thumbnail should be in JPEG format and less than 200 kB in size.
766761 A thumbnail's width and height should not exceed 90. Ignored if the file is not
767762 is passed as a string or file_id.
@@ -779,7 +774,7 @@ def send_video_note(self,
779774
780775 if isinstance (video_note , VideoNote ):
781776 video_note = video_note .file_id
782- if InputFile .is_file (video_note ):
777+ elif InputFile .is_file (video_note ):
783778 video_note = InputFile (video_note )
784779
785780 data = {'chat_id' : chat_id , 'video_note' : video_note }
@@ -825,7 +820,7 @@ def send_animation(self,
825820 duration (:obj:`int`, optional): Duration of sent animation in seconds.
826821 width (:obj:`int`, optional): Animation width.
827822 height (:obj:`int`, optional): Animation height.
828- thumb (`filelike object`): Thumbnail of the
823+ thumb (`filelike object`, optional ): Thumbnail of the
829824 file sent. The thumbnail should be in JPEG format and less than 200 kB in size.
830825 A thumbnail's width and height should not exceed 90. Ignored if the file is not
831826 is passed as a string or file_id.
@@ -855,7 +850,7 @@ def send_animation(self,
855850
856851 if isinstance (animation , Animation ):
857852 animation = animation .file_id
858- if InputFile .is_file (animation ):
853+ elif InputFile .is_file (animation ):
859854 animation = InputFile (animation )
860855
861856 data = {'chat_id' : chat_id , 'animation' : animation }
@@ -933,7 +928,7 @@ def send_voice(self,
933928
934929 if isinstance (voice , Voice ):
935930 voice = voice .file_id
936- if InputFile .is_file (voice ):
931+ elif InputFile .is_file (voice ):
937932 voice = InputFile (voice )
938933
939934 data = {'chat_id' : chat_id , 'voice' : voice }
@@ -3301,9 +3296,8 @@ def set_passport_data_errors(self, user_id, errors, timeout=None, **kwargs):
33013296
33023297 Args:
33033298 user_id (:obj:`int`): User identifier
3304- errors (List[:class:`PassportElementError`]): If this value is specified, use it as
3305- the read timeout from the server (instead of the one specified during
3306- creation of the connection pool).
3299+ errors (List[:class:`PassportElementError`]): A JSON-serialized array describing the
3300+ errors.
33073301 timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as
33083302 the read timeout from the server (instead of the one specified during
33093303 creation of the connection pool).
0 commit comments