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


Python TwilioTaskRouterClient.workflows方法代码示例

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


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

示例1: RestClientTest

# 需要导入模块: from twilio.rest import TwilioTaskRouterClient [as 别名]
# 或者: from twilio.rest.TwilioTaskRouterClient import workflows [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

示例2: TwilioTaskRouterClient

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

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
workspace_sid = "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

client = TwilioTaskRouterClient(account_sid, auth_token)

for workflow in client.workflows(workspace_sid).list():
	print(workflow.friendly_name)
开发者ID:TwilioDevEd,项目名称:api-snippets,代码行数:14,代码来源:example-1.5.x.py

示例3: WorkflowRule

# 需要导入模块: from twilio.rest import TwilioTaskRouterClient [as 别名]
# 或者: from twilio.rest.TwilioTaskRouterClient import workflows [as 别名]
salesRuleTargets.append(salesRuleTarget)
salesRule = WorkflowRule("type=='sales'", salesRuleTargets, None)

marketingRuleTargets = []
marketingRuleTarget = WorkflowRuleTarget(marketing_queue_sid, None, None, None)
marketingRuleTargets.append(marketingRuleTarget)
marketingRule = WorkflowRule("type=='marketing'", marketingRuleTargets, None)

supportRuleTargets = []
supportRuleTarget = WorkflowRuleTarget(support_queue_sid, None, None, None)
supportRuleTargets.append(supportRuleTarget)
supportRule = WorkflowRule("type=='support'", supportRuleTargets, None)

rules.append(salesRule)
rules.append(marketingRule)
rules.append(supportRule)

defaultTarget = WorkflowRuleTarget(everyone_queue_sid, None, None, None)
config = WorkflowConfig(rules, defaultTarget)
json = config.to_json()

workflow = client.workflows(workspace_sid).create(
    friendly_name='Sales, Marketing, Support Workflow',
    assignment_callback_url='http://example.com',
    fallback_assignment_callback_url='http://example2.com',
    task_reservation_timeout='30',
    configuration=json
)

print(workflow.friendly_name)
开发者ID:GilbertoBotaro,项目名称:api-snippets,代码行数:32,代码来源:example-1.5.x.py

示例4: TwilioTaskRouterClient

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

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
workspace_sid = "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
workflow_sid = "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

client = TwilioTaskRouterClient(account_sid, auth_token)

workflow = client.workflows(workspace_sid).get(workflow_sid)
print(workflow.friendly_name)
开发者ID:TwilioDevEd,项目名称:api-snippets,代码行数:15,代码来源:example-1.5.x.py

示例5: TwilioTaskRouterClient

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

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
workspace_sid = "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
workflow_sid = "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

client = TwilioTaskRouterClient(account_sid, auth_token)

workflow = client.workflows(workspace_sid).update(workflow_sid,task_reservation_timout='20')
print(workflow.task_reservation_timeout)

# alternatively
workflow = client.workflows(workspace_sid).get(workflow_sid)
workflow = workflow.update(task_reservation_timeout='20')
print(workflow.task_reservation_timeout)
开发者ID:TwilioDevEd,项目名称:api-snippets,代码行数:20,代码来源:example-1.5.x.py

示例6: TwilioTaskRouterClient

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

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
workspace_sid = "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
workflow_sid = "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

client = TwilioTaskRouterClient(account_sid, auth_token)

statistics = client.workflows(workspace_sid).get(workflow_sid).statistics.get()
print(statistics.cumulative["avg_task_acceptance_time"])
print(statistics.cumulative["tasks_entered"])
print(statistics.realtime["tasks_by_status"]["pending"])
print(statistics.realtime["tasks_by_status"]["assigned"])
开发者ID:TwilioDevEd,项目名称:api-snippets,代码行数:18,代码来源:example-1.5.x.py


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