twilio-python
twilio-python copied to clipboard
Sending media as chat participant, Conversations API
Issue Summary
Issue is that library is executing POST method onto url = https://media.twilio.com/v1/Services/<Service_SID>/Media
instead of https://mcs.us1.twilio.com/v1/Services/<Service_SID>/Media
. When I change URL in twilio/base/domain.py
everything is working good.
Code Snippet
with open(os.getenv('PICTURE'), 'rb') as f:
file = f.read()
auth = account_sid + ":" + auth_token
auth_bytes = auth.encode("ascii")
base64_bytes = base64.b64encode(auth_bytes)
base64_string = "Basic " + base64_bytes.decode("ascii")
media = client.media.v1 \
.create(
method="POST",
headers=
{
"Content-Type": "image/png",
"Authorization": base64_string},
data=file,
uri="/Services/" + os.getenv('DEFAULT_SERVICE_SID') + "/Media")
Exception/Log
Error ::
HTTP 404 error: Unable to create record: The requested resource /Services/<Service_SID>/Media was not found
Technical details:
- twilio-python version: 7.8.0
- python version: 3.9
This issue has been added to our internal backlog to be prioritized. Pull requests and +1s on the issue summary will help it move up the backlog.