def check_updates(): if check_new(): info(f'Обновление! ({release["tag_name"]})') assets = release['assets'] url = assets[0]['browser_download_url'] result = messagebox.askquestion('Обновление', f'Доступна новая версия ({release["tag_name"]})!\n' f'Хотите скачать обновление?', icon='warning') if result == 'yes': openurl(url=url) from sys import exit exit()
def on_tag(self, tag, view, event, _iter) -> None: """Callback for events that happen inside the tag.""" button = event.get_button() is_press = event.get_event_type() == Gdk.EventType.BUTTON_PRESS # If there was a click... if button[0] and is_press: # Left click if button[1] == 1: openurl(self.url) # Right click elif button[1] == 3: view.clicked_link = self.url
def getAccessToken(clientId, clientSecret) : authPayload_ = authPayload(clientId) accessPayload_ = accessPayload(clientId, clientSecret) def onCodeReceived(code) : accessPayload_['code'] = code server = SingleRequestHTTPServer(onCodeReceived) authUrl = '%s/?%s' % (AUTH_URL, urllib.urlencode(authPayload_)) openurl(authUrl) try : server.serve_forever() except Exception, err : print err server.server_close()
def getAccessToken(clientId, clientSecret): authPayload_ = authPayload(clientId) accessPayload_ = accessPayload(clientId, clientSecret) def onCodeReceived(code): accessPayload_['code'] = code server = SingleRequestHTTPServer(onCodeReceived) authUrl = '%s/?%s' % (AUTH_URL, urllib.urlencode(authPayload_)) openurl(authUrl) try: server.serve_forever() except Exception, err: print err server.server_close()
def _setup_signal_connections(self, builder): ''' Creates some GTK signals connections @param builder: a Gtk.Builder ''' signals = { 'on_add_button_clicked': self.on_add_button, 'on_BackendsDialog_delete_event': self.on_close, 'on_close_button_clicked': self.on_close, 'on_remove_button_clicked': self.on_remove_button, 'on_help_button_clicked': lambda w: openurl("help:gtg/gtg-add-sync"), } builder.connect_signals(signals)
def _setup_signal_connections(self, builder): ''' Creates some GTK signals connections @param builder: a gtk.Builder ''' signals = { 'on_add_button_clicked': self.on_add_button, 'on_BackendsDialog_delete_event': self.on_close, 'on_close_button_clicked': self.on_close, 'on_remove_button_clicked': self.on_remove_button, 'on_help_button_clicked': lambda w: openurl("help:gtg/gtg-add-sync"), } builder.connect_signals(signals)
def do_populate_popup(self, popup) -> None: """Adds link-related options to the context menu.""" if self.clicked_link: item_open_link = Gtk.MenuItem() item_open_link.set_label(_('Open Link')) item_open_link.connect('activate', lambda _m, url: openurl(url), self.clicked_link) popup.prepend(item_open_link) item_copy_link = Gtk.MenuItem() item_copy_link.set_label(_('Copy Link to Clipboard')) item_copy_link.connect('activate', self.copy_url, self.clicked_link) popup.prepend(item_copy_link) popup.show_all() self.clicked_link = ""
raw_input("Press <enter> to exit.") sys.exit(1) urlget = URLopener({}) errors = [] for line in f.readlines(): try: url, fname = [s.strip() for s in line.split(' ')] except ValueError: print("Could not parse this input: " + line) continue if osp.isfile(fname): print('Skipping existing file %s' % fname) else: print('Downloading %s to %s' % (url, fname)) try: urlget.retrieve(url, fname, report_progress) except IOError: print(' (!) Download failed, adding to plan B list') errors.append(url) if errors: print( "\nAn error(s) was detected; would you like to retry using the " + "system browser?") raw_input("Press Ctrl+C to exit or <enter> to continue.") for url in errors: openurl(url) raw_input("Press <enter> to exit.")
def open_help(self, action, param): """Open help callback.""" openurl("help:gtg")
def activate(self, view) -> None: """Open the link in this tag.""" openurl(self.url)
with prompt_toolkit.patch_stdout.patch_stdout(): try: email = prompt_toolkit.prompt("Enter Email: ") password = prompt_toolkit.prompt("Enter Password: "******"Opening Browser...") log.info( "Please sign in with the $CYAN$BOLDbot account $RESET$WHITEand $CYAN$BOLDcopy paste everything here$RESET$WHITE." ) sleep(2) openurl( "https://www.epicgames.com/id/login/epic?redirect_uri=https%3A%2F%2Fwww.epicgames.com%2Fid%2Fapi%2Fredirect%3FclientId%3D3446cd72694c4a4485d81b77adbb2141%26responseType%3Dcode" ) with prompt_toolkit.patch_stdout.patch_stdout(): try: return_url = prompt_toolkit.prompt( "Paste Here & Press Enter: ") except KeyboardInterrupt: break authorization_code = json.loads(return_url)["redirectUrl"].split( "https://accounts.epicgames.com/fnauth?code=") log.info("Spinning Up Temporary Client...") client = fortnitepy.Client(auth=fortnitepy.AdvancedAuth( email=email, password=password,
#!/usr/local/bin/python from __future__ import print_function import billboard from webbrowser import open as openurl print("Press enter to open the next song. This is to prevent opening 100 tabs at once.") print("Press Ctrl-C to exit the program entirely.") raw_input() chart = billboard.ChartData('hot-100') stub = "https://pulselocker.com/search/?" x = 1 for song in chart: artWords = song.artist.split() newArt = "" for word in artWords: if (word == "Featuring"): break else: if (newArt == ""): newArt = word else: newArt += " " + word newurl = "artist=" + newArt + "&track=" + song.title openurl(stub + newurl) print("#" + str(x) + ": " + song.title + " by " + newArt, end="") x += 1 raw_input("")
def show_help(help_addr): """ Open a specif help page for a given subject """ help_url = construct_help_addr(help_addr) openurl(help_url) return True