Reputation: 413
I am using Twilio Python SDK for verify services. I get below error when I try to send email OTPs.
{TwilioRestException}HTTP 404 error: Unable to create record: The requested resource
/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Verifications was not found
Below is my Python code to perform this task:
from twilio.rest import Client
client = Client('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', AUTH_TOKEN)
verification = self.client.verify.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')\
.verifications\
.create(to='[email protected]', channel='email')
When I use CURL to send request then it happens successfully and I receive the mail with the verify code.
curl -X POST https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Verifications \
--data-urlencode "[email protected]" \
--data-urlencode "Channel=email" \
-u ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token
The above POST call in POSTMAN gives me the below URL:
https://verify.twilio.com/v2/Services/VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Verifications/VEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
when I click on that URL that same error is thrown up as it was shown from Python SDK.
Note: But from POSTMAN I am getting receiving Email but not from Python SDK.
Why am I getting the above mentioned error in Python, even after following the steps of DOCS. https://www.twilio.com/docs/verify/email?code-sample=code-check-an-email-verification&code-language=Python&code-sdk-version=6.x#create-a-sendgrid-api-key
Upvotes: 0
Views: 963
Reputation: 73057
Twilio developer evangelist here.
We spoke privately about this question. It turned out that Vijay was using the Twilio Python library version 6.20.0.
I recommended upgrading to the latest version of Twilio Python, 6.41.0 (as I write this), and that fixed the issue.
Upvotes: 2
Reputation: 10781
Did you ensure you are running a more recent version of the Python SDK.
Upvotes: 0