Sending media as chat participant, Conversations API
Open
Nobody has claimed this yet.
priority: low
status: help wanted
type: community enhancement
- Dominant language
- Python
- Stars
- 2.1k
- Forks
- 815
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 2
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in twilio/base/domain.py and trace how client.media.v1 builds the media request URL. Confirm that creating Conversations media targets mcs.us1.twilio.com rather than media.twilio.com, and verify the reported 404 no longer occurs for the provided media upload call.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100