def __init__(self): print('Initialise RunLumiApi...') self._sockson = False self.urlsvc = os.getenv('CDMS_HOST', 'http://localhost:8080/crestapi') if os.getenv('CDMS_SOCKS', False) and not self._sockson: self.activatesocks() self._sockson = True self.api_client = ApiClient(host=self.urlsvc) self.__folder = None self.__iovlist = [] self.__tag = None self.__coolpayload = None self.__payload = {'hash': None, 'payload': None} logging.basicConfig(format='%(asctime)s %(message)s') self._logger = logging.getLogger('RunLumiApi') self._logger.setLevel(logging.INFO)
def __init__(self): # process command line options try: self._command = sys.argv[0] self.useSocks = False self.snap = 0 self.t0 = 0 self.tMax = 'INF' self.debug = False self.trace = 'on' self.by = 'none' self.sort = 'none' self.page = 0 self.pagesize = 1000 self.iovspan = 'time' self.jsondump = False self.dump = False self.user = '******' self.passwd = 'none' self.outfilename = '' self.api_client = None self.phtools = None self.urlsvc = os.getenv( 'CREST_HOST', 'http://crest-undertow.web.cern.ch/crestapi') longopts = [ 'help', 'socks', 'out=', 'jsondump', 't0=', 'tMax=', 'snap=', 'url=', 'debug', 'trace=', 'by=', 'page=', 'pagesize=', 'iovspan=', 'user='******'pass='******'sort=' ] opts, args = getopt.getopt(sys.argv[1:], '', longopts) print('%s, %s' % (opts, args)) self.procopts(opts, args) except getopt.GetoptError as e: print(e) self.usage() sys.exit(-1) if self.useSocks: self.activatesocks() self._config = Configuration() self._config.host = self.urlsvc self.api_client = ApiClient(self._config) self.execute()
def sanitizeForDeserialization(self,data, klass): api_client = ApiClient() instance = api_client._ApiClient__deserialize(data, klass) return instance
def sanitizeForSerialization(self,obj): api_client = ApiClient() obj_dict = api_client.sanitize_for_serialization(obj) # obj_dict = {obj.attribute_map[attr]: getattr(obj, attr) # for attr, _ in iteritems(obj.swagger_types) if getattr(obj, attr) is not None} return obj_dict