def startMainLoop(self, configDict): iteration = 1 while 1==1: useCases = ConfigUseCases() useCases.create(configDict) print("#{} Main HUB loop started".format(iteration)) print("# Config HUB -- {}".format(useCases.toString())) print("# Starting service - sites") servicesApi = MeLiApiService() # if configDict["services"]["sites"] == True: response = servicesApi.sites(useCases) print("# Service HUB -- {}".format(response)) # if configDict["services"]["categories"] == True: response = servicesApi.categories(useCases) print("# Service HUB -- {}".format(response)) # if configDict["services"]["catalog_listing"] == True: print("# Starting service - catalog listing") response = servicesApi.catalogListByQuery(useCases) print("# Service HUB -- {}".format(response)) # if configDict["services"]["csv_file"] == True: print("# Generating CSV file") response = servicesApi.catalogListByQuery(useCases) self.printCsv(response) # Geração de arquivo csv # iteration = iteration + 1 time.sleep(5)
def startMainLoop(self, configDict): iteration = 1 while 1==1: useCases = ConfigUseCases() useCases.create(configDict) print("#{} Main HUB loop started".format(iteration)) print("# Config HUB -- {}".format(useCases.toString())) print("# Starting service - sites") servicesApi = MeLiApiService() for service in configDict['services']: if service == "sites": response = servicesApi.sites(useCases) elif service == "categories": response = servicesApi.categories(useCases) elif service == "catalog_listing": response = servicesApi.catalogListByQuery(useCases) self.printCsv(response) #print("# Starting {}".format(service)) #print("# Service HUB -- {}".format(response)) iteration = iteration + 1 time.sleep(5)