• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python three.Three类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中three.Three的典型用法代码示例。如果您正苦于以下问题:Python Three类的具体用法?Python Three怎么用?Python Three使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: test_shortened_between_keyword

 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)
开发者ID:siruguri,项目名称:three,代码行数:7,代码来源:test.py


示例2: test_only_start_keyword_arguments

 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)
开发者ID:siruguri,项目名称:three,代码行数:7,代码来源:test.py


示例3: test_between_can_handle_datetimes

 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)
开发者ID:siruguri,项目名称:three,代码行数:7,代码来源:test.py


示例4: test_a_default_post

 def test_a_default_post(self):
     t = Three('api.city.gov', api_key='my_api_key')
     t.post('123', name='Zach Williams', address='85 2nd Street')
     params = {'first_name': 'Zach', 'last_name': 'Williams',
               'service_code': '123', 'address_string': '85 2nd Street',
               'api_key': 'my_api_key'}
     expected = 'https://api.city.gov/requests.json'
     t.session.post.assert_called_with(expected, data=params, files=None)
开发者ID:SeeClickFix,项目名称:three,代码行数:8,代码来源:test.py


示例5: test_between_keyword_argument

 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)
开发者ID:SeeClickFix,项目名称:three,代码行数:9,代码来源:test.py


示例6: test_start_and_end_keyword_arguments

 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)
开发者ID:SeeClickFix,项目名称:three,代码行数:9,代码来源:test.py


示例7: test_between_can_handle_datetimes

 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)
开发者ID:SeeClickFix,项目名称:three,代码行数:10,代码来源:test.py


示例8: test_shortened_between_keyword

 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)
开发者ID:SeeClickFix,项目名称:three,代码行数:10,代码来源:test.py


示例9: test_only_start_keyword_arguments

 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)
开发者ID:SeeClickFix,项目名称:three,代码行数:10,代码来源:test.py


示例10: test_a_default_post

 def test_a_default_post(self):
     t = Three("api.city.gov", api_key="my_api_key")
     t.post("123", name="Zach Williams", address="85 2nd Street")
     params = {
         "first_name": "Zach",
         "last_name": "Williams",
         "service_code": "123",
         "address_string": "85 2nd Street",
         "api_key": "my_api_key",
     }
     expected = "https://api.city.gov/requests.json"
     req.post.assert_called_with(expected, data=params)
开发者ID:siruguri,项目名称:three,代码行数:12,代码来源:test.py


示例11: test_post_request_with_api_key_argument

 def test_post_request_with_api_key_argument(self):
     t = Three('http://seeclicktest.com/open311/v2')
     t.post('1627', name='Zach Williams', address='120 Spring St',
            description='Just a test post.', phone='555-5555',
            api_key='my_api_key')
     params = {
         'first_name': 'Zach', 'last_name': 'Williams',
         'description': 'Just a test post.', 'service_code': '1627',
         'address_string': '120 Spring St', 'phone': '555-5555',
         'api_key': 'my_api_key'
     }
     expected = 'http://seeclicktest.com/open311/v2/requests.json'
     t.session.post.assert_called_with(expected, data=params, files=None)
开发者ID:SeeClickFix,项目名称:three,代码行数:13,代码来源:test.py


示例12: test_a_default_post

    def test_a_default_post(self):
        responses.add(responses.POST, 'https://api.city.gov/requests.json',
                  body="""[
                  {
                    "service_request_id":293944,
                    "service_notice":"The City will inspect and require the responsible party to correct within 24 hours and/or issue a Correction Notice or Notice of Violation of the Public Works Code",
                    "account_id":null
                    }
                  ]""",
                  status=201,
                  content_type='application/json')

        t = Three('api.city.gov', api_key='my_api_key')
        resp = t.post('123', name='Zach Williams', address='85 2nd Street')
        params = {'first_name': 'Zach', 'last_name': 'Williams',
                  'service_code': '123', 'address_string': '85 2nd Street',
                  'api_key': 'my_api_key'}

        assert resp.status_code == 201
开发者ID:codeforamerica,项目名称:three,代码行数:19,代码来源:test.py


示例13: test_reset_method_reconfigures_defaults

 def test_reset_method_reconfigures_defaults(self):
     t = Three("foo.bar")
     self.assertEqual(t.endpoint, "https://foo.bar/")
     t.configure(endpoint="bar.bar")
     self.assertEqual(t.endpoint, "https://bar.bar/")
     t.configure(endpoint="http://baz.bar")
     self.assertEqual(t.endpoint, "http://baz.bar/")
     t.reset()
     self.assertEqual(t.endpoint, "https://foo.bar/")
开发者ID:siruguri,项目名称:three,代码行数:9,代码来源:test.py


示例14: test_post_request_with_api_key_argument

 def test_post_request_with_api_key_argument(self):
     t = Three("http://seeclicktest.com/open311/v2")
     t.post(
         "1627",
         name="Zach Williams",
         address="120 Spring St",
         description="Just a test post.",
         phone="555-5555",
         api_key="my_api_key",
     )
     params = {
         "first_name": "Zach",
         "last_name": "Williams",
         "description": "Just a test post.",
         "service_code": "1627",
         "address_string": "120 Spring St",
         "phone": "555-5555",
         "api_key": "my_api_key",
     }
     expected = "http://seeclicktest.com/open311/v2/requests.json"
     req.post.assert_called_with(expected, data=params)
开发者ID:siruguri,项目名称:three,代码行数:21,代码来源:test.py


示例15: test_specific_service_code

 def test_specific_service_code(self):
     t = Three('api.city.gov')
     t.services('123')
     expected = 'https://api.city.gov/services/123.json'
     t.session.get.assert_called_with(expected, params={})
开发者ID:SeeClickFix,项目名称:three,代码行数:5,代码来源:test.py


示例16: test_discovery_url_argument

 def test_discovery_url_argument(self):
     t = Three('api.city.gov')
     t.discovery('http://testing.gov/discovery.json')
     t.session.get.assert_called_with('http://testing.gov/discovery.json')
开发者ID:SeeClickFix,项目名称:three,代码行数:4,代码来源:test.py


示例17: test_between_keyword_argument

 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)
开发者ID:siruguri,项目名称:three,代码行数:6,代码来源:test.py


示例18: test_empty_services_call

 def test_empty_services_call(self):
     t = Three('api.city.gov')
     t.services()
     expected = 'https://api.city.gov/services.json'
     t.session.get.assert_called_with(expected, params={})
开发者ID:SeeClickFix,项目名称:three,代码行数:5,代码来源:test.py


示例19: test_start_and_end_keyword_arguments

 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)
开发者ID:siruguri,项目名称:three,代码行数:6,代码来源:test.py


示例20: test_keyword_arguments_become_parameters

 def test_keyword_arguments_become_parameters(self):
     t = Three("api.city.gov")
     t.services("123", foo="bar")
     params = {"foo": "bar"}
     expected = "https://api.city.gov/services/123.json"
     req.get.assert_called_with(expected, params=params)
开发者ID:siruguri,项目名称:three,代码行数:6,代码来源:test.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python celery_logger.debug函数代码示例发布时间:2022-05-27
下一篇:
Python RequestObject.RequestObject类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap