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


Python Client.send方法代码示例

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


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

示例1: test_client_shutdown_async

# 需要导入模块: from opbeat.base import Client [as 别名]
# 或者: from opbeat.base.Client import send [as 别名]
 def test_client_shutdown_async(self, mock_traces_collect, mock_send):
     client = Client(
         servers=["http://example.com"],
         organization_id="organization_id",
         app_id="app_id",
         secret_token="secret",
         async_mode=True,
     )
     client.send(auth_header="foo", **{"foo": "bar"})
     client.close()
     self.assertEqual(mock_traces_collect.call_count, 1)
     self.assertEqual(mock_send.call_count, 1)
开发者ID:opbeat,项目名称:opbeat_python,代码行数:14,代码来源:client_tests.py

示例2: test_send_not_enabled

# 需要导入模块: from opbeat.base import Client [as 别名]
# 或者: from opbeat.base.Client import send [as 别名]
    def test_send_not_enabled(self, time, send_remote):
        time.return_value = 1328055286.51
        with mock.patch.dict("os.environ", {"OPBEAT_DISABLE_SEND": "true"}):
            client = Client(
                servers=["http://example.com"],
                organization_id="organization_id",
                app_id="app_id",
                secret_token="secret",
            )
        client.send(**{"foo": "bar"})

        assert not send_remote.called
开发者ID:opbeat,项目名称:opbeat_python,代码行数:14,代码来源:client_tests.py

示例3: test_client_shutdown_async

# 需要导入模块: from opbeat.base import Client [as 别名]
# 或者: from opbeat.base.Client import send [as 别名]
 def test_client_shutdown_async(self, mock_traces_collect, mock_send):
     client = Client(
         servers=['http://example.com'],
         organization_id='organization_id',
         app_id='app_id',
         secret_token='secret',
         async_mode=True,
     )
     client.send(auth_header='foo', **{
         'foo': 'bar',
     })
     client.close()
     self.assertEqual(mock_traces_collect.call_count, 1)
     self.assertEqual(mock_send.call_count, 1)
开发者ID:bastih,项目名称:opbeat_python,代码行数:16,代码来源:client_tests.py

示例4: test_send_not_enabled

# 需要导入模块: from opbeat.base import Client [as 别名]
# 或者: from opbeat.base.Client import send [as 别名]
    def test_send_not_enabled(self, time, send_remote):
        time.return_value = 1328055286.51
        with mock.patch.dict('os.environ', {'OPBEAT_DISABLE_SEND': 'true'}):
            client = Client(
                servers=['http://example.com'],
                organization_id='organization_id',
                app_id='app_id',
                secret_token='secret',
            )
        client.send(**{
            'foo': 'bar',
        })

        assert not send_remote.called
开发者ID:bastih,项目名称:opbeat_python,代码行数:16,代码来源:client_tests.py

示例5: test_send_with_auth_header

# 需要导入模块: from opbeat.base import Client [as 别名]
# 或者: from opbeat.base.Client import send [as 别名]
 def test_send_with_auth_header(self, time, send_remote):
     time.return_value = 1328055286.51
     client = Client(
         servers=["http://example.com"], organization_id="organization_id", app_id="app_id", secret_token="secret"
     )
     client.send(auth_header="foo", **{"foo": "bar"})
     send_remote.assert_called_once_with(
         url="http://example.com",
         data=six.b("x\x9c\xabVJ\xcb\xcfW\xb2RPJJ,R\xaa\x05\x00 \x98\x04T"),
         headers={
             "Content-Type": "application/octet-stream",
             "Authorization": "foo",
             "User-Agent": "opbeat-python/%s" % opbeat.VERSION,
             "X-Opbeat-Platform": self.client.get_platform_info(),
         },
     )
开发者ID:opbeat,项目名称:opbeat_python,代码行数:18,代码来源:client_tests.py

示例6: test_send_with_auth_header

# 需要导入模块: from opbeat.base import Client [as 别名]
# 或者: from opbeat.base.Client import send [as 别名]
 def test_send_with_auth_header(self, time, send_remote):
     time.return_value = 1328055286.51
     client = Client(
         servers=['http://example.com'],
         organization_id='organization_id',
         app_id='app_id',
         secret_token='secret',
     )
     client.send(auth_header='foo', **{
         'foo': 'bar',
     })
     send_remote.assert_called_once_with(
         url='http://example.com',
         data=six.b('x\x9c\xabVJ\xcb\xcfW\xb2RPJJ,R\xaa\x05\x00 \x98\x04T'),
         headers={
             'Content-Type': 'application/octet-stream',
             'Authorization': 'foo',
             'User-Agent': 'opbeat-python/%s' % opbeat.VERSION,
             'X-Opbeat-Platform': self.client.get_platform_info(),
         },
     )
开发者ID:bastih,项目名称:opbeat_python,代码行数:23,代码来源:client_tests.py

示例7: test_send

# 需要导入模块: from opbeat.base import Client [as 别名]
# 或者: from opbeat.base.Client import send [as 别名]
 def test_send(self, time, send_remote):
     time.return_value = 1328055286.51
     public = "public"
     access_token = "secret"
     client = Client(
         servers=['http://example.com'],
         organization_id='organization_id',
         app_id='app_id',
         secret_token='secret',
     )
     client.send(**{
         'foo': 'bar',
     })
     send_remote.assert_called_once_with(
         url='http://example.com',
         data=six.b('x\x9c\xabVJ\xcb\xcfW\xb2RPJJ,R\xaa\x05\x00 \x98\x04T'),
         headers={
             'Content-Type': 'application/octet-stream',
             'Authorization': 'Bearer %s' % (access_token),
             'User-Agent': 'opbeat-python/%s' % opbeat.VERSION
         },
     )
开发者ID:rSieben,项目名称:opbeat_python,代码行数:24,代码来源:client_tests.py


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