Skip to content

[BUG] self.client in a function instead of class #856

Open
@Ismael144

Description

@Ismael144

Describe the bug

In examples/public_oauth.py, trying to access 'self' in a function which is not a method of a class

Code snippet

def example():
    """
    Some example usage of message resources.
    """
    self.client = Client(
        account_sid=ACCOUNT_SID,
        credential_provider=ClientCredentialProvider(CLIENT_ID, CLIENT_SECRET),
    )

    msg = self.client.messages.create(
        to=self.to_number, from_=self.from_number, body="hello world"
    )

Actual behavior

Fail to run because of trying to access self in function which is not a method of a class

Expected behavior

To create and output a twilio message

twilio-python version

8.0.0-rc.2

Python version

3.12.4

Logs or error messages

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: highNeeds immediate attention; blockers or critical or bugtype: docs updatedocumentation change not affecting the code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions