Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Ismael144 opened this issue Apr 15, 2025 · 1 comment · May be fixed by #858
Open

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

Ismael144 opened this issue Apr 15, 2025 · 1 comment · May be fixed by #858
Labels
priority: high Needs immediate attention; blockers or critical or bug type: docs update documentation change not affecting the code

Comments

@Ismael144
Copy link

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

@Ismael144 Ismael144 added the type: bug bug in the library label Apr 15, 2025
@tiwarishubham635 tiwarishubham635 linked a pull request Apr 21, 2025 that will close this issue
8 tasks
@tiwarishubham635 tiwarishubham635 added type: docs update documentation change not affecting the code priority: high Needs immediate attention; blockers or critical or bug and removed type: bug bug in the library labels Apr 21, 2025
@tiwarishubham635
Copy link
Contributor

Raised #858 for this. Please review. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high Needs immediate attention; blockers or critical or bug type: docs update documentation change not affecting the code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants