本文整理汇总了Python中ovh.client.Client.get方法的典型用法代码示例。如果您正苦于以下问题:Python Client.get方法的具体用法?Python Client.get怎么用?Python Client.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ovh.client.Client
的用法示例。
在下文中一共展示了Client.get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get
# 需要导入模块: from ovh.client import Client [as 别名]
# 或者: from ovh.client.Client import get [as 别名]
def test_get(self, m_call):
# basic test
api = Client(ENDPOINT, APPLICATION_KEY, APPLICATION_SECRET, CONSUMER_KEY)
self.assertEqual(m_call.return_value, api.get(FAKE_URL))
m_call.assert_called_once_with('GET', FAKE_URL, None, True)
# append query string
m_call.reset_mock()
api = Client(ENDPOINT, APPLICATION_KEY, APPLICATION_SECRET, CONSUMER_KEY)
self.assertEqual(m_call.return_value, api.get(FAKE_URL, param="test"))
m_call.assert_called_once_with('GET', FAKE_URL+'?param=test', None, True)
# append to existing query string
m_call.reset_mock()
api = Client(ENDPOINT, APPLICATION_KEY, APPLICATION_SECRET, CONSUMER_KEY)
self.assertEqual(m_call.return_value, api.get(FAKE_URL+'?query=string', param="test"))
m_call.assert_called_once_with('GET', FAKE_URL+'?query=string¶m=test', None, True)
# boolean arguments
m_call.reset_mock()
api = Client(ENDPOINT, APPLICATION_KEY, APPLICATION_SECRET, CONSUMER_KEY)
self.assertEqual(m_call.return_value, api.get(FAKE_URL+'?query=string', checkbox=True))
m_call.assert_called_once_with('GET', FAKE_URL+'?query=string&checkbox=true', None, True)
# keyword calling convention
m_call.reset_mock()
api = Client(ENDPOINT, APPLICATION_KEY, APPLICATION_SECRET, CONSUMER_KEY)
self.assertEqual(m_call.return_value, api.get(FAKE_URL, _from="start", to="end"))
try:
m_call.assert_called_once_with('GET', FAKE_URL+'?to=end&from=start', None, True)
except:
m_call.assert_called_once_with('GET', FAKE_URL+'?from=start&to=end', None, True)
示例2: test_get
# 需要导入模块: from ovh.client import Client [as 别名]
# 或者: from ovh.client.Client import get [as 别名]
def test_get(self, m_call):
# basic test
api = Client(ENDPOINT, APPLICATION_KEY, APPLICATION_SECRET, CONSUMER_KEY)
self.assertEqual(m_call.return_value, api.get(FAKE_URL))
m_call.assert_called_once_with('GET', FAKE_URL, None, True)
# append query string
m_call.reset_mock()
api = Client(ENDPOINT, APPLICATION_KEY, APPLICATION_SECRET, CONSUMER_KEY)
self.assertEqual(m_call.return_value, api.get(FAKE_URL, param="test"))
m_call.assert_called_once_with('GET', FAKE_URL+'?param=test', None, True)
# append to existing query string
m_call.reset_mock()
api = Client(ENDPOINT, APPLICATION_KEY, APPLICATION_SECRET, CONSUMER_KEY)
self.assertEqual(m_call.return_value, api.get(FAKE_URL+'?query=string', param="test"))
m_call.assert_called_once_with('GET', FAKE_URL+'?query=string¶m=test', None, True)
示例3: test_get
# 需要导入模块: from ovh.client import Client [as 别名]
# 或者: from ovh.client.Client import get [as 别名]
def test_get(self, m_call):
api = Client(ENDPOINT, APPLICATION_KEY, APPLICATION_SECRET, CONSUMER_KEY)
self.assertEqual(m_call.return_value, api.get(FAKE_URL))
m_call.assert_called_once_with('GET', FAKE_URL, None, True)