@@ -511,26 +511,21 @@ <h1 class="title">Module <code>client</code></h1>
511
511
512
512
def upload_file(self,
513
513
file: typing.BinaryIO = None,
514
- payload: dict = None,
515
514
headers: dict = None) -> httpx.Response:
516
515
''' Uploads a file to the server as a temporary file. It returns a URL that expires
517
516
after 24 hours unless the URL is used in `send_event`.
518
517
519
518
Args:
520
519
file (typing.BinaryIO): File-like object with file to upload (Maximum size: 10MB).
521
- payload (dict): Custom payload to be used as request's data.
522
- It overrides all other parameters provided for the method.
523
520
headers (dict): Custom headers to be used with session headers.
524
521
They will be merged with session-level values that are set,
525
522
however, these method-level parameters will not be persisted across requests.
526
523
527
524
Returns:
528
525
httpx.Response: The Response object from `httpx` library,
529
526
which contains a server’s response to an HTTP request. '''
530
- if payload is None:
531
- payload = prepare_payload(locals())
532
527
return self.session.post(f'{self.api_url}/upload_file',
533
- json=payload ,
528
+ content=file.read() ,
534
529
headers=headers)
535
530
536
531
def send_rich_message_postback(self,
@@ -2722,26 +2717,21 @@ <h3>Inherited members</h3>
2722
2717
2723
2718
def upload_file(self,
2724
2719
file: typing.BinaryIO = None,
2725
- payload: dict = None,
2726
2720
headers: dict = None) -> httpx.Response:
2727
2721
''' Uploads a file to the server as a temporary file. It returns a URL that expires
2728
2722
after 24 hours unless the URL is used in `send_event`.
2729
2723
2730
2724
Args:
2731
2725
file (typing.BinaryIO): File-like object with file to upload (Maximum size: 10MB).
2732
- payload (dict): Custom payload to be used as request's data.
2733
- It overrides all other parameters provided for the method.
2734
2726
headers (dict): Custom headers to be used with session headers.
2735
2727
They will be merged with session-level values that are set,
2736
2728
however, these method-level parameters will not be persisted across requests.
2737
2729
2738
2730
Returns:
2739
2731
httpx.Response: The Response object from `httpx` library,
2740
2732
which contains a server’s response to an HTTP request. '''
2741
- if payload is None:
2742
- payload = prepare_payload(locals())
2743
2733
return self.session.post(f'{self.api_url}/upload_file',
2744
- json=payload ,
2734
+ content=file.read() ,
2745
2735
headers=headers)
2746
2736
2747
2737
def send_rich_message_postback(self,
@@ -5581,7 +5571,7 @@ <h2 id="returns">Returns</h2>
5581
5571
</ details >
5582
5572
</ dd >
5583
5573
< dt id ="client.AgentWebInterface.upload_file "> < code class ="name flex ">
5584
- < span > def < span class ="ident "> upload_file</ span > </ span > (< span > self, file: typing.BinaryIO = None, payload: dict = None, headers: dict = None) ‑> httpx.Response</ span >
5574
+ < span > def < span class ="ident "> upload_file</ span > </ span > (< span > self, file: typing.BinaryIO = None, headers: dict = None) ‑> httpx.Response</ span >
5585
5575
</ code > </ dt >
5586
5576
< dd >
5587
5577
< div class ="desc "> < p > Uploads a file to the server as a temporary file. It returns a URL that expires
@@ -5590,9 +5580,6 @@ <h2 id="args">Args</h2>
5590
5580
< dl >
5591
5581
< dt > < strong > < code > file</ code > </ strong > : < code > typing.BinaryIO</ code > </ dt >
5592
5582
< dd > File-like object with file to upload (Maximum size: 10MB).</ dd >
5593
- < dt > < strong > < code > payload</ code > </ strong > : < code > dict</ code > </ dt >
5594
- < dd > Custom payload to be used as request's data.
5595
- It overrides all other parameters provided for the method.</ dd >
5596
5583
< dt > < strong > < code > headers</ code > </ strong > : < code > dict</ code > </ dt >
5597
5584
< dd > Custom headers to be used with session headers.
5598
5585
They will be merged with session-level values that are set,
@@ -5610,26 +5597,21 @@ <h2 id="returns">Returns</h2>
5610
5597
</ summary >
5611
5598
< pre > < code class ="python "> def upload_file(self,
5612
5599
file: typing.BinaryIO = None,
5613
- payload: dict = None,
5614
5600
headers: dict = None) -> httpx.Response:
5615
5601
''' Uploads a file to the server as a temporary file. It returns a URL that expires
5616
5602
after 24 hours unless the URL is used in `send_event`.
5617
5603
5618
5604
Args:
5619
5605
file (typing.BinaryIO): File-like object with file to upload (Maximum size: 10MB).
5620
- payload (dict): Custom payload to be used as request's data.
5621
- It overrides all other parameters provided for the method.
5622
5606
headers (dict): Custom headers to be used with session headers.
5623
5607
They will be merged with session-level values that are set,
5624
5608
however, these method-level parameters will not be persisted across requests.
5625
5609
5626
5610
Returns:
5627
5611
httpx.Response: The Response object from `httpx` library,
5628
5612
which contains a server’s response to an HTTP request. '''
5629
- if payload is None:
5630
- payload = prepare_payload(locals())
5631
5613
return self.session.post(f'{self.api_url}/upload_file',
5632
- json=payload ,
5614
+ content=file.read() ,
5633
5615
headers=headers)</ code > </ pre >
5634
5616
</ details >
5635
5617
</ dd >
0 commit comments