@@ -495,10 +495,10 @@ def _check_redirects(self, result: requests.Response) -> None:
495495def _prepare_send_data (
496496self ,
497497files :Optional [Dict [str ,Any ]]= None ,
498- post_data :Optional [Dict [str ,Any ]]= None ,
498+ post_data :Optional [Union [ Dict [str ,Any ], bytes ]]= None ,
499499raw :bool = False ,
500500 )-> Tuple [
501- Optional [Dict [str ,Any ]],
501+ Optional [Union [ Dict [str ,Any ], bytes ]],
502502Optional [Union [Dict [str ,Any ],MultipartEncoder ]],
503503str ,
504504 ]:
@@ -508,6 +508,8 @@ def _prepare_send_data(
508508else :
509509# booleans does not exists for data (neither for MultipartEncoder):
510510# cast to string int to avoid: 'bool' object has no attribute 'encode'
511+ if TYPE_CHECKING :
512+ assert isinstance (post_data ,dict )
511513for k ,v in post_data .items ():
512514if isinstance (v ,bool ):
513515post_data [k ]= str (int (v ))
@@ -527,7 +529,7 @@ def http_request(
527529verb :str ,
528530path :str ,
529531query_data :Optional [Dict [str ,Any ]]= None ,
530- post_data :Optional [Dict [str ,Any ]]= None ,
532+ post_data :Optional [Union [ Dict [str ,Any ], bytes ]]= None ,
531533raw :bool = False ,
532534streamed :bool = False ,
533535files :Optional [Dict [str ,Any ]]= None ,
@@ -544,7 +546,7 @@ def http_request(
544546 path (str): Path or full URL to query ('/projects' or
545547 'http://whatever/v4/api/projecs')
546548 query_data (dict): Data to send as query parameters
547- post_data (dict): Data to send in the body (will be converted to
549+ post_data (dict|bytes ): Data to send in the body (will be converted to
548550 json by default)
549551 raw (bool): If True, do not convert post_data to json
550552 streamed (bool): Whether the data should be streamed
@@ -800,7 +802,7 @@ def http_put(
800802self ,
801803path :str ,
802804query_data :Optional [Dict [str ,Any ]]= None ,
803- post_data :Optional [Dict [str ,Any ]]= None ,
805+ post_data :Optional [Union [ Dict [str ,Any ], bytes ]]= None ,
804806raw :bool = False ,
805807files :Optional [Dict [str ,Any ]]= None ,
806808** kwargs :Any ,
@@ -811,7 +813,7 @@ def http_put(
811813 path (str): Path or full URL to query ('/projects' or
812814 'http://whatever/v4/api/projecs')
813815 query_data (dict): Data to send as query parameters
814- post_data (dict): Data to send in the body (will be converted to
816+ post_data (dict|bytes ): Data to send in the body (will be converted to
815817 json by default)
816818 raw (bool): If True, do not convert post_data to json
817819 files (dict): The files to send to the server