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


Python Three.post方法代码示例

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


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

示例1: test_a_default_post

# 需要导入模块: from three import Three [as 别名]
# 或者: from three.Three import post [as 别名]
 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,代码行数:10,代码来源:test.py

示例2: test_a_default_post

# 需要导入模块: from three import Three [as 别名]
# 或者: from three.Three import post [as 别名]
 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,代码行数:14,代码来源:test.py

示例3: test_post_request_with_api_key_argument

# 需要导入模块: from three import Three [as 别名]
# 或者: from three.Three import post [as 别名]
 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,代码行数:15,代码来源:test.py

示例4: test_post_request_with_api_key_argument

# 需要导入模块: from three import Three [as 别名]
# 或者: from three.Three import post [as 别名]
 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,代码行数:23,代码来源:test.py

示例5: test_a_default_post

# 需要导入模块: from three import Three [as 别名]
# 或者: from three.Three import post [as 别名]
    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,代码行数:21,代码来源:test.py


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