line / line-bot-sdk-python

LINE Messaging API SDK for Python
https://pypi.python.org/pypi/line-bot-sdk
Apache License 2.0
1.87k stars 962 forks source link

Cannot get `Content-Type` in `MessagingApiBlob().get_message_content()`. #609

Closed Onishichi closed 3 months ago

Onishichi commented 3 months ago

Problem

I am creating an application that uses the MessagingApiBlob().get_message_content() to save the retrieved file.
There is no information on what extension should be specified for the file extension when saving the file, and I cannot decide on a file name.
The LINE Developers documentation says to get the file format from the Content-Type header.

The file format of the binary data is indicated in the Content-Type header of the response.

https://developers.line.biz/en/reference/messaging-api/#get-content

I want to get the Content-Type in line-bot-sdk-python as well.

Onishichi commented 3 months ago

I understand from reading the source code that I can set kwargs['_return_http_data_only'] = False as a parameter and call get_message_content_with_http_info.

This Issue is closed.

Yang-33 commented 3 months ago

Hi @Onishichi, thank you for using line-bot-sdk-python.

Yes, please read https://github.com/line/line-bot-sdk-python?tab=readme-ov-file#how-to-get-x-line-request-id-header-and-error-message.

How to get x-line-request-id header and error message

You may need to store the x-line-request-id header obtained as a response from several APIs. In this case, please use ~_with_http_info functions. You can get headers and status codes. The x-line-accepted-request-id or content-type header can also be obtained in the same way.