8000 Create dummy clients which will throw an exception when instantiated · Pull Request #386 · twilio/twilio-python · GitHub
[go: up one dir, main page]

Skip to content

Create dummy clients which will throw an exception when instantiated #386

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

Merged
merged 5 commits into from
Aug 18, 2017

Conversation

ghost
Copy link
@ghost ghost commented Aug 18, 2017

No description provided.

8000
@@ -496,3 +497,75 @@ def __repr__(self):
:rtype: str
"""
return '<Twilio {}>'.format(self.account_sid)


@deprecated_client
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we just made one DeprecatedClient and then did

TwilioClient = DeprecatedClient
TwilioRestClient = DeprecatedClient
TwilioIpMessageClient = DeprecatedClient

raise ObsoleteException("{} has been removed from this version of the library. "
"Please refer to current documentation for guidance."
.format(func.__name__))
return func(*args, **kwargs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for return here.


class TestDummyClients(unittest.TestCase):
def test_deprecation_error_twilioclient(self):
self.assertRaises(DeprecationWarning, TwilioClient,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ObsoleteWarning

@obsolete_client
class TwilioClient(object):
""" Dummy client which provides no functionality. Please use
Twilio.Rest.Client instead. """
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be lowercase twilio.rest.Client.

@dougblack dougblack merged commit c6e75bc into master Aug 18, 2017
@childish-sambino childish-sambino deleted the DEVX-5297-detect-old-clients branch March 12, 2019 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0