def main(): # prototype source of tables: csv files file1 = '../Test/acQuire Data/01c All Collar.csv' file2 = '../Test/acQuire Data/02 Survey.csv' file3 = '../Test/acQuire Data/03 Lithology.csv' file4 = '../Test/acQuire Data/04 Alteration.csv' file5 = '../Test/acQuire Data/05 Samples Checks.csv' # from Download ################################# # create instance: session session = Download() # define source tables session.setTableSource("Hole", file1) session.setTableSource("Survey", file2) session.setTableSource("Interval1", file3) session.setTableSource("Interval2", file4) session.setTableSource("Samples", file5) # set the fields list session.setFieldsList("Hole") session.setFieldsList("Survey") session.setFieldsList("Interval1") session.setFieldsList("Interval2") session.setFieldsList("Samples") # define the Hole List session.defineHoleList() # define final contents to create offline db session.setAvailableContent() # from WebView ################################## # create instance: web web = WebView() # create files list web.createFileList(session.contentList, session.holeList) # create index.html file web.createIndexPage(session.contentList, session.holeList) # create Hole%.html files web.createHolePages(session.contentList, session.holeList, session.dictOfFields[1]) # create Survey%.html files web.createSurveyPages(session.contentList, session.holeList, session.dictOfFields[2]) # create Interval%.html files web.createIntervalPages(session.contentList, session.holeList, session.dictOfFields) # TEST ########################################## # Download ###################################### print session.holeList print session.contentList #print session.tableOrder["Samples"] #print session.tableOrder.keys() #print help(session) #print session.getFieldNames("Interval1") #print session.dictOfTables #print session.dictOfTables[session.tableOrder["Hole"]] print session.dictOfFields[1]
def searchQuery(q, start): API_HOST = choice(loadBestNIP(config.TOP_IP_FILE, 20)) SEARCH_API = 'https://' + API_HOST + '/search?q=' dobj = Download(SEARCH_API + q + '&start=' + start) if (dobj.doRequest()): return None else: return dobj.getSOURCE()
def download(self,command): #NOTE check input currentDL = Download(command,self.library) #passes reference to library so it can check if things are already in the library and stop the process if currentDL.downloadedSuccessfully(): self.library.addSong(currentDL.getSong()) print "[!] DONE!" else: print "[!] ERROR WHILE DOWNLOADING"
def __main__(): check_files_and_folders() socket = Socket.ServerSocket() connection = socket.Socket() sr = Server(connection, Cryptography.session_crypto(None), Registery.Registery(), Login.serverLogin(), Download.Download(), Upload.Upload(), List.List(), Read.Read(), Write.Write(), SessionKeyExchange.ServerSession(None), DACCommands.DACCommands(), Auditor.Auditor()) sr.Handler()
def scholarQuery(q, start): API_HOST = choice(loadBestNIP(config.TOP_IP_FILE, 20)) SCHOLAR_API = 'http://' + API_HOST + '/scholar?q=' # dobj = Download(SCHOLAR_API + q + '&start=' + start) dobj = Download(SCHOLAR_API + q + '&start=' + start) if (dobj.doRequest()): return None else: return dobj.getSOURCE()
def queryGoogle(q, start): API_HOST = choice(loadBestNIP(config.TOP_IP_FILE, 20)) # print "Debug: " + API_HOST GOOGLE_API = 'http://' + API_HOST + '/search?q=' dobj = Download(GOOGLE_API + q + '&start=' + start) if (dobj.doRequest()): return None else: return dobj.getSOURCE()
def run(self): Download.CreatePath() t = open("CardsDB.txt") ln = 0 for ch in t: start = time.time() ln = ln + 1 ch = ch.rstrip('\n') if ch != "": size = Download.Download(ch + ".jpg") end = time.time() elapsedtime = end - start linevar = 13636 - ln speed = 0 if type(size) != type(None): try: speed = ((int(size) / 1024) / elapsedtime) except ZeroDivisionError: pass percentage = 100 - round((linevar * 50) / 6815) if percentage > 99 and linevar != 0: percentage = 99 if ch != "": if speed == 0: progr = "Skipping " + ch + ".jpg" + "! Already Exists..." print(progr) else: progr = "Downloading " + ch + ".jpg" + " @" + str( round(speed)) + "kb/s " + str( linevar) + " cards left..." print(progr) time.sleep(0.001) self.change_perc.emit(percentage) self.change_lab.emit(progr) #self.progressBar.setValue(percentage) print("Task Completed ! Check you pics folder.") t.close()
def create_download(self, name, size, description=GithubObject.NotSet, content_type=GithubObject.NotSet): assert isinstance(name, (str, unicode)), name assert isinstance(size, (int, long)), size assert description is GithubObject.NotSet or isinstance( description, (str, unicode)), description assert content_type is GithubObject.NotSet or isinstance( content_type, (str, unicode)), content_type post_parameters = { "name": name, "size": size, } if description is not GithubObject.NotSet: post_parameters["description"] = description if content_type is not GithubObject.NotSet: post_parameters["content_type"] = content_type headers, data = self._requester.requestAndCheck( "POST", self.url + "/downloads", None, post_parameters) return Download.Download(self._requester, data, completed=True)
def install(self, url, targetPath, key=None, ui=None): """Install the file located in the url given. Args: url (str): The url to download the package to install. targetPath (str): Where to install the package. key (str): If the system needs a key to access. Defaults to None. ui (InstallatorUI): User Interface connection. Defaults to None. """ if ui: ui.progressText.append('Starting downloading files...') download = Download.Download(url, key, ui=ui) download.download() downloadedPath = download.getExtractedPath( ) or download.getFileDownloaded() if ui: ui.progressText.append('Installing the files...') install = Install.Install(downloadedPath, targetPath, ui=ui) install.install() if ui: ui.progressText.append('Installation successful') ui.progressBar.setValue(100)
def EmailHunterDetect(self): ''' A function to use EmailHunter to use their JSON API to detect the email format. ''' try: # This returns a JSON object dl = Download.Download(self.verbose) url = "https://api.hunter.io/v2/domain-search?domain=" + \ self.domain + self.type + "&limit=100&offset=0" + "&api_key=" + self.apikeyv r = dl.requesturl(url, useragent=self.UserAgent, raw=True) results = r.json() pattern = str(results['data']['pattern']) if pattern: return pattern else: if self.verbose: e = ' [!] No pattern detected via EmailHunter API' print helpers.color(e, firewall=True) return False except: error = "[!] Major issue with EmailHunter Search:" + str(e) print helpers.color(error, warning=True)
def get_download(self, id): assert isinstance(id, (int, long)), id headers, data = self._requester.requestAndCheck( "GET", self.url + "/downloads/" + str(id), None, None) return Download.Download(self._requester, data, completed=True)
import kdb_csv as kc import Download #--------------------------------------------- ''' 加载 config 文件 ''' with open('configs/config_main.json', 'r') as f: config_main = json.loads(f.read()) runD = config_main['runD'] if (runD): print(dt.datetime.now(), 'load config: config_main') with open('configs/config_download.json', 'r') as f: config_download = json.loads(f.read()) if (runD): print(dt.datetime.now(), 'load config: config_download') #--------------------------------------------- ''' 下载数据 ''' if config_main['option']['whether_download_data'] == 1: if (runD): print(dt.datetime.now(), 'process: download data') Download.Download(config_download) else: if (runD): print(dt.datetime.now(), 'process: give up download data') ''' 加载数据 ''' ''' 处理数据 '''
def __init__(self): self.request_object = None self.request_list = [] self.thread = __Threading.ThreadManager() self.download = Download.Download() self.request_buf = []
font=('arial', 10), text="240p", variable=self.quality, value=4, bg=self.clr).grid(row=1, column=5, sticky=N, pady=10) but6 = Radiobutton(self.bottom, font=('arial', 10), text="144p", variable=self.quality, value=5, bg=self.clr).grid(row=1, column=6, sticky=N, pady=10) def clr_url(self): self.url.delete(0, 'end') def close(self): if (messagebox.askokcancel('Quit', 'Do you want to quit?')): self.root.destroy() else: pass download = Download.Download() main = main(download)
def __init__(self): self.download = Download.Download(logger) self.parser = Parser.Parser() self.output = Output.Output()