本文整理汇总了Python中WMCore.Services.Requests.JSONRequests.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python JSONRequests.__init__方法的具体用法?Python JSONRequests.__init__怎么用?Python JSONRequests.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WMCore.Services.Requests.JSONRequests
的用法示例。
在下文中一共展示了JSONRequests.__init__方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from WMCore.Services.Requests import JSONRequests [as 别名]
# 或者: from WMCore.Services.Requests.JSONRequests import __init__ [as 别名]
def __init__(self, url = 'http://localhost:5984', usePYCurl = False, ckey = None, cert = None, capath = None):
"""
Initialise requests
"""
JSONRequests.__init__(self, url, {"cachepath" : None, "pycurl" : usePYCurl, "key" : ckey, "cert" : cert, "capath" : capath})
self.accept_type = "application/json"
self["timeout"] = 600
示例2: __init__
# 需要导入模块: from WMCore.Services.Requests import JSONRequests [as 别名]
# 或者: from WMCore.Services.Requests.JSONRequests import __init__ [as 别名]
def __init__(self, dict):
defaultdict = {'endpoint': "https://cmsweb.cern.ch/registration/",
'cacheduration': 1,
'cachepath': '/tmp'}
defaultdict.update(dict)
defaultdict["method"] = 'PUT'
if 'logger' not in defaultdict.keys():
logging.basicConfig(level = logging.DEBUG,
format = '%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
datefmt = '%m-%d %H:%M',
filename = defaultdict['cachepath'] + '/regsvc.log',
filemode = 'w')
defaultdict['logger'] = logging.getLogger('RegService')
Service.__init__(self, defaultdict)
JSONRequests.__init__(self, defaultdict['endpoint'])