Python sample code of hudson remote api, my first Python hello world
来源:互联网 发布:淘宝刷钻助理 编辑:程序博客网 时间:2024/06/06 23:50
refer http://wiki.hudson-ci.org/display/HUDSON/Remote+access+API for more about hudson remote api
#!/usr/bin/env python
# this script is only demo purpose which is designed to get properties of job, queue, like
# nextBuildNumber. But note the logistics might not be correct
import urllib2
#call api of job 'git_plugin_test'
url="http://localhost:9001/job/git_plugin_test/api/python?depth=0"
response=urllib2.urlopen(url)
build_dict=eval(response.read())
#call api of job 'queue' of hudson (global but not specific for one job)
url="http://localhost:9001/queue/api/python?depth=0"
response=urllib2.urlopen(url)
queue_dict=eval(response.read())
print ''*40,'build dict',''*40
#print properties of job
for eachKey in build_dict:
print eachKey,build_dict[eachKey]
print ''*40,'queue dict',''*40
#look through items in queue and can be extended to forecast the job build
#number in for one item in queue
for index in range(1,len(queue_dict['items'])):
print ''*40,'queue hash',''*40
qi_action=queue_dict['items'][index]['actions']
list_para=qi_action[0]['parameters']
for index1 in range(0,len(list_para)):
print list_para[index1]
if list_para[index1]['name'] == 'SLEEP_TIME' and list_para[index1]['value'] == '62':
print "OK"
#only valid when no more than one build found in queue
if build_dict['inQueue']:
build_number=int(build_dict['nextBuildNumber']) + 1
else:
build_number=int(build_dict['nextBuildNumber'])
print "Hudson Build URL:",build_dict['url']+str(build_number)
print "Current build tree:"+build_dict['builds'][0]['url']
- Python sample code of hudson remote api, my first Python hello world
- Android Sample Code之API Demos (Activity一): Hello World
- [Source Code] My First Python Program
- My first Python
- My first Python script
- Hudson remote api list
- python中的hello world
- Python 的Hello World
- Python hello world
- Python 的Hello World!
- python的hello,world
- Python's Hello,world
- Hello World-python
- python webservice hello world
- Python - Hello World
- python hello world
- 【Python】Hello World 输入输出
- python之Hello World
- 转载一篇关于linux 监视进程的文章...
- Dr.com 小贴士
- ssh整合OA
- 关于缓存的一种想法
- 关闭触控器和机器滴音
- Python sample code of hudson remote api, my first Python hello world
- HDU 菲波数 JAVA大数。。。第一个!!~~~
- 使用 MVC 设计模式的 Dojo Grid
- PHP中的header()函数详解
- asp.net的<% %>总结
- sizeof()和strlen()最彻底的阐释
- IE6/IE7/FF的CSS hack总结
- 函数OMX_MasterInit()的实现
- 给自己的网站加一个搜索功能代码