本文整理汇总了Python中Main.getThings方法的典型用法代码示例。如果您正苦于以下问题:Python Main.getThings方法的具体用法?Python Main.getThings怎么用?Python Main.getThings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Main
的用法示例。
在下文中一共展示了Main.getThings方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Exception
# 需要导入模块: import Main [as 别名]
# 或者: from Main import getThings [as 别名]
__author__ = 'asee2278'
import Main
import httplib2
import json
# tested just the function
print Main.getThings()
address = 'http://localhost:5000'
#Making a get call for things
print "Making a get call for things "
import requests
r = requests.get("http://localhost:5000/things")
print r.status_code
print r.content
try:
url = address + "/things"
h = httplib2.Http()
resp, result = h.request(url, 'GET')
#obj = json.loads(result)
#puppyID = obj['Puppy']['id']
if resp['status'] != '200':
raise Exception('Received an unsuccessful status code of %s' % resp['status'])
except Exception as err:
print "Test 1 FAILED: Could not make POST Request to web server"