当前位置: 首页>>代码示例>>Python>>正文


Python TwilioRestClient.members方法代码示例

本文整理汇总了Python中twilio.rest.TwilioRestClient.members方法的典型用法代码示例。如果您正苦于以下问题:Python TwilioRestClient.members方法的具体用法?Python TwilioRestClient.members怎么用?Python TwilioRestClient.members使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twilio.rest.TwilioRestClient的用法示例。


在下文中一共展示了TwilioRestClient.members方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: RestClientTest

# 需要导入模块: from twilio.rest import TwilioRestClient [as 别名]
# 或者: from twilio.rest.TwilioRestClient import members [as 别名]
class RestClientTest(unittest.TestCase):

    def setUp(self):
        self.client = TwilioRestClient("ACCOUNT_SID", "AUTH_TOKEN")

    @patch("twilio.rest.make_request")
    def test_request(self, mock):
        self.client.request("2010-04-01", method="GET")
        mock.assert_called_with("GET", "https://api.twilio.com/2010-04-01",
            headers={"User-Agent": 'twilio-python'}, params={},
            auth=AUTH, data=None)

    def test_connect_apps(self):
        self.assertIsInstance(self.client.connect_apps,
            resources.ConnectApps)

    def test_authorized_apps(self):
        self.assertIsInstance(self.client.authorized_connect_apps,
            resources.AuthorizedConnectApps)

    @patch("twilio.rest.resources.base.make_request")
    def test_conferences(self, mock):
        mock.return_value = Mock()
        mock.return_value.ok = True
        mock.return_value.content = '{"conferences": []}'
        self.client.conferences.list()

    @patch("twilio.rest.resources.base.make_twilio_request")
    def test_members(self, mock):
        resp = create_mock_json("tests/resources/members_list.json")
        mock.return_value = resp
        self.client.members("QU123").list()
        uri = "https://api.twilio.com/2010-04-01/Accounts/ACCOUNT_SID/Queues/QU123/Members"
        mock.assert_called_with("GET", uri, params={}, auth=AUTH)
开发者ID:Shakahs,项目名称:twilio-python,代码行数:36,代码来源:test_client.py

示例2: RestClientTest

# 需要导入模块: from twilio.rest import TwilioRestClient [as 别名]
# 或者: from twilio.rest.TwilioRestClient import members [as 别名]
class RestClientTest(unittest.TestCase):
    def setUp(self):
        self.client = TwilioRestClient("ACCOUNT_SID", "AUTH_TOKEN")
        self.task_router_client = TwilioTaskRouterClient("ACCOUNT_SID",
                                                         "AUTH_TOKEN")

    @patch("twilio.rest.base.make_request")
    def test_request(self, mock):
        self.client.request("2010-04-01", method="GET")
        mock.assert_called_with("GET", "https://api.twilio.com/2010-04-01",
                                headers={"User-Agent": ANY,
                                         'Accept-Charset': 'utf-8',
                                         'Authorization':
                                         'Basic QUNDT1VOVF9TSUQ6QVVUSF9UT0tFTg=='},
                                params={}, auth=AUTH, data=None)
        called_kwargs = mock.mock_calls[0][2]
        self.assertTrue(
            'twilio-python' in called_kwargs['headers']['User-Agent']
        )

    def test_connect_apps(self):
        assert_true(isinstance(self.client.connect_apps,
                               resources.ConnectApps))

    def test_authorized_apps(self):
        assert_true(isinstance(self.client.authorized_connect_apps,
                               resources.AuthorizedConnectApps))

    @patch("twilio.rest.resources.base.make_request")
    def test_conferences(self, mock):
        mock.return_value = Mock()
        mock.return_value.ok = True
        mock.return_value.content = '{"conferences": []}'
        self.client.conferences.list()

    @patch("twilio.rest.resources.base.make_twilio_request")
    def test_members(self, mock):
        resp = create_mock_json("tests/resources/members_list.json")
        mock.return_value = resp
        self.client.members("QU123").list()
        uri = "https://api.twilio.com/2010-04-01/Accounts/ACCOUNT_SID" \
              "/Queues/QU123/Members"
        mock.assert_called_with("GET", uri, params={}, auth=AUTH,
                                use_json_extension=True)

    @patch("twilio.rest.resources.base.make_request")
    def test_workflows(self, request):
        resp = create_mock_json(
            "tests/resources/task_router/workflows_list.json"
        )
        request.return_value = resp
        workflows = self.task_router_client.workflows("WS123")
        workflows = workflows.list()
        assert_true(workflows[0].sid is not None)
        uri = "https://taskrouter.twilio.com/v1/Workspaces/WS123/Workflows"
        request.assert_called_with("GET", uri, headers=ANY, params={},
                                   auth=AUTH)
开发者ID:lyft,项目名称:twilio-python,代码行数:59,代码来源:test_client.py

示例3: RestClientTimeoutTest

# 需要导入模块: from twilio.rest import TwilioRestClient [as 别名]
# 或者: from twilio.rest.TwilioRestClient import members [as 别名]
class RestClientTimeoutTest(unittest.TestCase):
    def setUp(self):
        self.client = TwilioRestClient("ACCOUNT_SID", "AUTH_TOKEN", timeout=sentinel.timeout)

    @patch("twilio.rest.resources.base.make_twilio_request")
    def test_members(self, mock_request):
        resp = create_mock_json("tests/resources/members_list.json")
        mock_request.return_value = resp
        self.client.members("QU123").list()
        mock_request.assert_called_with("GET", ANY, params=ANY, auth=AUTH, timeout=sentinel.timeout)

    @patch("twilio.rest.resources.base.make_twilio_request")
    def test_arbitrary_member(self, mock_request):
        mock_response = Mock()
        mock_response.ok = True
        mock_response.content = json.dumps({"short_codes": []})
        mock_request.return_value = mock_response
        self.assertEqual([], self.client.sms.short_codes.list())
        mock_request.assert_called_once_with("GET", ANY, params=ANY, auth=AUTH, timeout=sentinel.timeout)
开发者ID:Stackdriver,项目名称:twilio-python,代码行数:21,代码来源:test_client.py

示例4: TwilioRestClient

# 需要导入模块: from twilio.rest import TwilioRestClient [as 别名]
# 或者: from twilio.rest.TwilioRestClient import members [as 别名]
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

member = client.members('QU5ef8732a3c49700934481addd5ce1659'
                        ).get("CA386025c9bf5d6052a1d1ea42b4d16662")
print(member.wait_time)
开发者ID:GilbertoBotaro,项目名称:api-snippets,代码行数:13,代码来源:instance-get-example-1.5.x.py

示例5: TwilioRestClient

# 需要导入模块: from twilio.rest import TwilioRestClient [as 别名]
# 或者: from twilio.rest.TwilioRestClient import members [as 别名]
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "{{ auth_token }}"
client = TwilioRestClient(account_sid, auth_token)

member = client.members('QU5ef8732a3c49700934481addd5ce1659').dequeue("http://demo.twilio.com/docs/voice.xml", "CA5ef8732a3c49700934481addd5ce1659", method="POST")
print member.position
开发者ID:crtr0,项目名称:api-snippets,代码行数:12,代码来源:instance-post-example-2.py

示例6: TwilioRestClient

# 需要导入模块: from twilio.rest import TwilioRestClient [as 别名]
# 或者: from twilio.rest.TwilioRestClient import members [as 别名]
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

# A list of member objects with the properties described above
members = client.members('QU5ef8732a3c49700934481addd5ce1659').list()
开发者ID:GilbertoBotaro,项目名称:api-snippets,代码行数:12,代码来源:list-get-example-1.5.x.py


注:本文中的twilio.rest.TwilioRestClient.members方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。