本文整理汇总了Python中utils.get_status函数的典型用法代码示例。如果您正苦于以下问题:Python get_status函数的具体用法?Python get_status怎么用?Python get_status使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_status函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: get_status
def get_status(self):
"""Get status"""
if not self.type:
return get_status('http://ws.audioscrobbler.com/1.0/user/%s/recenttracks.rss' % (self.name))
elif self.type == 1:
return get_status('http://twitter.com/statuses/user_timeline/%s.rss' % (self.name))
else:
return get_status('http://rss.juick.com/%s/blog' % (self.name))
开发者ID:andyzsf,项目名称:djang0byte,代码行数:8,代码来源:models.py
示例2: add
def add(host_id=None):
db = getdb()
data = {}
if request.method == "POST":
for item in request.form:
if item == "submit":
action = request.form[item]
else:
data[item] = request.form[item]
data["status"] = get_status(data["inputIP"])
if host_id:
if action == "delete":
db.remove(eids=[host_id])
return redirect(url_for("index"))
else:
db.update(data, eids=[host_id])
else:
host_id = db.insert(data)
if action == "save":
return redirect(url_for("add", host_id=host_id))
else:
return redirect(url_for("index"))
else:
if host_id:
data = db.get(eid=host_id)
return Menu.render("add.html", data=data, host_id=host_id)
开发者ID:ZUNbado,项目名称:wol,代码行数:27,代码来源:app.py
示例3: get_status
def get_status():
'''
Returns either a status object or its text represenation when given a valid
token string.
curl localhost:8081:/status?token=4f7b38cf02f0ba5c38000000
curl 'localhost:8081:/status?token=4f7b38cf02f0ba5c38000000&human_readable=true'
'''
token = utils.str_to_obj(request.query.get('token'))
if not token:
raise HTTPResponse('Please specify a valid token.\n', 400)
# Output formatting
status = utils.get_status(token, no_id=True)
human_readable = request.query.get('human_readable')
if status:
if human_readable: # Return text depending on the deployment's status
if status['Deployment finished']:
return 'Deployment finished.\n'
elif status['Error occured']:
return 'Error occured during deployment.\n'
else:
try:
return '%s.\n' % status['running step']
except KeyError:
return 'Error occured before the beginning of deployment.\n'
else: # Just return the whole status object
return utils.stringify(status)
else:
raise HTTPResponse('No status found for this token\n', 404)
开发者ID:flypunk,项目名称:sds,代码行数:29,代码来源:bottle_app.py
示例4: update_status
def update_status(host_id=None):
db = getdb()
if host_id:
hosts = [db.get(eid=host_id)]
else:
hosts = db.all()
for host in hosts:
status = get_status(host["inputIP"])
db.update({"status": status}, eids=[host.eid])
return redirect(url_for("index"))
开发者ID:ZUNbado,项目名称:wol,代码行数:10,代码来源:app.py
示例5: display_instances
def display_instances(request):
# Get existing containers
status = utils.get_status()
keys = status[status.keys()[0]].keys()
# Set variables for template
context = {}
context['keys'] = keys
context['containers'] = status
return render(request, 'manager/monitor_instances.html', context)
开发者ID:BDGL-Hacks,项目名称:Docker,代码行数:11,代码来源:views.py
示例6: test_vtgate
def test_vtgate(self):
# do a few vtgate topology queries to prime the cache
vtgate_client = zkocc.ZkOccConnection("localhost:%u" % vtgate_port,
"test_nj", 30.0)
vtgate_client.dial()
vtgate_client.get_srv_keyspace_names("test_nj")
vtgate_client.get_srv_keyspace("test_nj", "test_keyspace")
vtgate_client.get_end_points("test_nj", "test_keyspace", "-80", "master")
vtgate_client.close()
status = utils.get_status(vtgate_port)
self.assertIn('</html>', status) # end of page
self.assertIn('/serving_graph/test_nj">test_nj', status) # vtctld link
utils.pause("You can now run a browser and connect to http://localhost:%u%s to manually check vtgate status page" % (vtgate_port, environment.status_url))
开发者ID:acid009,项目名称:vitess,代码行数:15,代码来源:vtctld_test.py
示例7: save_model
def save_model(self, request, obj, form, change):
### additional helpers to speed up data entry
obj.scmurl = utils.normalize_checkout_url(obj.scmurl) or utils.get_checkout_url(obj.website)
obj.scmtype = utils.get_scm_type(obj.scmurl, obj.scmtype)
obj.bugurl = bugs.normalize_bug_format_string(obj.bugurl) or bugs.get_bug_format_string(obj.website)
obj.bugtype = bugs.get_bug_type(obj.bugurl, obj.bugtype)
try:
obj.changelog = obj.changelog or utils.get_changelog(obj.scmurl)
except:
pass
### end helpers
# perform checks before moving to VERIFIED
result = utils.test_if_package_verified(obj)
# print any messages from the test
for (msg_type, msg_text) in result['messages']:
messages.add_message(request, msg_type, msg_text)
obj.status = utils.get_status(result['scores'], utils.SCORES_PACKAGE_VERIFIED, STATUS_VERIFIED, STATUS_MODIFIED)
if obj.status == STATUS_VERIFIED:
messages.success(request, "All data successfully VERIFIED")
elif obj.status == STATUS_MODIFIED:
messages.warning(request, "Status is MODIFIED")
obj.assigned_to = request.user.username
if obj.status == STATUS_MODIFIED:
obj.status = STATUS_ASSIGNED
# NB: using this ugly .update() instead of save() because it allows for data partitioning
# However object fields are set above to please the test_if_package_verified() function
# so that it doesn't have to hit the DB again.
Package.objects.filter(
pk=obj.pk
).update(
website = obj.website,
scmurl = obj.scmurl,
scmtype = obj.scmtype,
bugurl = obj.bugurl,
bugtype = obj.bugtype,
changelog = obj.changelog,
subpackage_path = obj.subpackage_path,
status = obj.status
)
开发者ID:Acidburn0zzz,项目名称:difio,代码行数:47,代码来源:admin.py
示例8: test_status
def test_status(self):
self.assertIn('</html>', utils.get_status(vtgate_port))
开发者ID:bill2004158,项目名称:vitess,代码行数:2,代码来源:vtgatev2_test.py
示例9: get_status
def get_status(self):
return utils.get_status(self.port)
开发者ID:ateleshev,项目名称:youtube-vitess,代码行数:2,代码来源:tablet.py
示例10: test_status
def test_status(self):
port = self.env.port
self.assertIn('</html>', utils.get_status(port))
开发者ID:Acidburn0zzz,项目名称:vitess,代码行数:3,代码来源:status_tests.py
示例11: test_status
def test_status(self):
try:
port = self.env.tablet.port
except AttributeError:
port = self.env.vtoccport
self.assertIn('</html>', utils.get_status(port))
开发者ID:AndreMouche,项目名称:vitess,代码行数:6,代码来源:status_tests.py
注:本文中的utils.get_status函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论