Itop REST/JSON services 验证登陆方法

#!/usr/local/bin/python 
#coding:utf-8 
  
import urllib  
import urllib2  
import json  
   
def http_post():  
    url="http://100.173.191.60/web/webservices/rest.php?version=1.3"  
    auth ={"auth_user": "itop" , "auth_pwd": "2134xxzx"}
    opr = {"operation": "list_operations"}  
    oprjson =urllib.urlencode({'json_data': json.dumps(opr)}  )
    jdata = urllib.urlencode(auth)
    jdata = jdata+'&'+oprjson
    response = urllib.urlopen(url,jdata) 
    return response.read()         
   
rep=http_post()
print rep

你可能感兴趣的:(Itop REST/JSON services 验证登陆方法)