twilio-python icon indicating copy to clipboard operation
twilio-python copied to clipboard

[DOCS INCONSISTENCY] rest client parameters have no auth_token

Open raisultan opened this issue 5 years ago • 6 comments

Issue Summary

Rest client does not take auth_token as an argument, but username and password, even though all over documentation auth_token is used

Steps to Reproduce

  1. import rest client
  2. try to initialize client with sid and auth_token
  3. client does not take auth_token

Technical details:

  • twilio-python version: 6.46.0
  • python version: 3.8.1

raisultan avatar Oct 24 '20 13:10 raisultan

Could you provide more details, code samples, and links for what you're trying to accomplish? Are you referring to client initialization using named params?

childish-sambino avatar Oct 29 '20 20:10 childish-sambino

Could you provide more details, code samples, and links for what you're trying to accomplish? Are you referring to client initialization using named params?

Yep, Im talking about client initialization. After fetching latest version of library, I tried to initialize the client as it was done in official documentation but it seems that client does not take auth_token argument anymore. After examining the library itself, it is clear that it takes username and password instead.

raisultan avatar Oct 30 '20 04:10 raisultan

Could you provide a link to the documentation you're referring to that's incorrect?

Account SID plus auth token should work fine. Docs here: https://github.com/twilio/twilio-python#api-credentials

childish-sambino avatar Oct 30 '20 16:10 childish-sambino

Could you provide a link to the documentation you're referring to that's incorrect?

Account SID plus auth token should work fine. Docs here: https://github.com/twilio/twilio-python#api-credentials

Twilio rest client source code: https://github.com/twilio/twilio-python/blob/main/twilio/rest/init.py#L24 I can't see auth_token as a parameter.

Documentation: https://www.twilio.com/docs/sms/send-messages (pl: python, line: 10 - initialization of client instance)

raisultan avatar Oct 31 '20 07:10 raisultan

The examples in the docs you've linked show initializing the client with the account SID auth token: client = Client(account_sid, auth_token)

The code itself calls these args username, password as they're meant to be more generic. For example, these args can either be your account_sid, auth_token, or they can be your api_key_sid, api_key_secret.

An example of the latter here: https://www.twilio.com/docs/iam/keys/api-key-resource?code-sample=code-authenticate-with-api-key-and-api-secret&code-language=Python&code-sdk-version=6.x

childish-sambino avatar Nov 02 '20 15:11 childish-sambino

After your explanation, got it. But it is very implicit and not clear for the first time. It would be great if documentation was more self-explanatory.

raisultan avatar Nov 02 '20 16:11 raisultan