本文整理汇总了Python中three.Three.request方法的典型用法代码示例。如果您正苦于以下问题:Python Three.request方法的具体用法?Python Three.request怎么用?Python Three.request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类three.Three
的用法示例。
在下文中一共展示了Three.request方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_between_can_handle_datetimes
# 需要导入模块: from three import Three [as 别名]
# 或者: from three.Three import request [as 别名]
def test_between_can_handle_datetimes(self):
t = Three("api.city.gov")
dates = (date(2010, 3, 10), date(2010, 3, 15))
t.request("123", between=dates)
expected = "https://api.city.gov/requests/123.json"
params = {"start_date": "2010-03-10T00:00:00Z", "end_date": "2010-03-15T00:00:00Z"}
req.get.assert_called_with(expected, params=params)
示例2: test_only_start_keyword_arguments
# 需要导入模块: from three import Three [as 别名]
# 或者: from three.Three import request [as 别名]
def test_only_start_keyword_arguments(self):
t = Three("api.city.gov")
t.request("456", start="03-01-2010")
end_date = date.today().strftime("%Y-%m-%dT00:00:00Z")
expected = "https://api.city.gov/requests/456.json"
params = {"start_date": "2010-03-01T00:00:00Z", "end_date": end_date}
req.get.assert_called_with(expected, params=params)
示例3: test_shortened_between_keyword
# 需要导入模块: from three import Three [as 别名]
# 或者: from three.Three import request [as 别名]
def test_shortened_between_keyword(self):
t = Three("api.city.gov")
dates = ("03-01-10", "03-05-10")
t.request("123", between=dates)
expected = "https://api.city.gov/requests/123.json"
params = {"start_date": "2010-03-01T00:00:00Z", "end_date": "2010-03-05T00:00:00Z"}
req.get.assert_called_with(expected, params=params)
示例4: test_between_keyword_argument
# 需要导入模块: from three import Three [as 别名]
# 或者: from three.Three import request [as 别名]
def test_between_keyword_argument(self):
t = Three('api.city.gov')
t.request('789', between=['03-01-2010', '03-05-2010'])
expected = 'https://api.city.gov/requests/789.json'
params = {
'start_date': '2010-03-01T00:00:00Z',
'end_date': '2010-03-05T00:00:00Z'
}
t.session.get.assert_called_with(expected, params=params)
示例5: test_start_and_end_keyword_arguments
# 需要导入模块: from three import Three [as 别名]
# 或者: from three.Three import request [as 别名]
def test_start_and_end_keyword_arguments(self):
t = Three('api.city.gov')
t.request('456', start='03-01-2010', end='03-05-2010')
expected = 'https://api.city.gov/requests/456.json'
params = {
'start_date': '2010-03-01T00:00:00Z',
'end_date': '2010-03-05T00:00:00Z'
}
t.session.get.assert_called_with(expected, params=params)
示例6: test_between_can_handle_datetimes
# 需要导入模块: from three import Three [as 别名]
# 或者: from three.Three import request [as 别名]
def test_between_can_handle_datetimes(self):
t = Three('api.city.gov')
dates = (date(2010, 3, 10), date(2010, 3, 15))
t.request('123', between=dates)
expected = 'https://api.city.gov/requests/123.json'
params = {
'start_date': '2010-03-10T00:00:00Z',
'end_date': '2010-03-15T00:00:00Z'
}
t.session.get.assert_called_with(expected, params=params)
示例7: test_shortened_between_keyword
# 需要导入模块: from three import Three [as 别名]
# 或者: from three.Three import request [as 别名]
def test_shortened_between_keyword(self):
t = Three('api.city.gov')
dates = ('03-01-10', '03-05-10')
t.request('123', between=dates)
expected = 'https://api.city.gov/requests/123.json'
params = {
'start_date': '2010-03-01T00:00:00Z',
'end_date': '2010-03-05T00:00:00Z'
}
t.session.get.assert_called_with(expected, params=params)
示例8: test_only_start_keyword_arguments
# 需要导入模块: from three import Three [as 别名]
# 或者: from three.Three import request [as 别名]
def test_only_start_keyword_arguments(self):
t = Three('api.city.gov')
t.request('456', start='03-01-2010')
end_date = date.today().strftime('%Y-%m-%dT00:00:00Z')
expected = 'https://api.city.gov/requests/456.json'
params = {
'start_date': '2010-03-01T00:00:00Z',
'end_date': end_date
}
t.session.get.assert_called_with(expected, params=params)
示例9: test_between_keyword_argument
# 需要导入模块: from three import Three [as 别名]
# 或者: from three.Three import request [as 别名]
def test_between_keyword_argument(self):
t = Three("api.city.gov")
t.request("789", between=["03-01-2010", "03-05-2010"])
expected = "https://api.city.gov/requests/789.json"
params = {"start_date": "2010-03-01T00:00:00Z", "end_date": "2010-03-05T00:00:00Z"}
req.get.assert_called_with(expected, params=params)
示例10: test_start_and_end_keyword_arguments
# 需要导入模块: from three import Three [as 别名]
# 或者: from three.Three import request [as 别名]
def test_start_and_end_keyword_arguments(self):
t = Three("api.city.gov")
t.request("456", start="03-01-2010", end="03-05-2010")
expected = "https://api.city.gov/requests/456.json"
params = {"start_date": "2010-03-01T00:00:00Z", "end_date": "2010-03-05T00:00:00Z"}
req.get.assert_called_with(expected, params=params)
示例11: test_getting_a_specific_request
# 需要导入模块: from three import Three [as 别名]
# 或者: from three.Three import request [as 别名]
def test_getting_a_specific_request(self):
t = Three("api.city.gov")
t.request("123")
expected = "https://api.city.gov/requests/123.json"
req.get.assert_called_with(expected, params={})
示例12: test_getting_a_specific_request
# 需要导入模块: from three import Three [as 别名]
# 或者: from three.Three import request [as 别名]
def test_getting_a_specific_request(self):
t = Three('api.city.gov')
t.request('123')
expected = 'https://api.city.gov/requests/123.json'
t.session.get.assert_called_with(expected, params={})