Python webbrowser.open_new() Examples
The following are 30
code examples of webbrowser.open_new().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
webbrowser
, or try the search function
.
Example #1
Source File: webrecorder_full.py From conifer with Apache License 2.0 | 6 votes |
def __init__(self, argres): self.root_dir = argres.root_dir self.redis_dir = os.path.join(self.root_dir, 'redis') self.user_manager = None self.browser_redis = None self.default_user = argres.default_user self.browser_id = base64.b32encode(os.urandom(15)).decode('utf-8') self.dat_share_port = argres.dat_share_port self.behaviors_tarfile = argres.behaviors_tarfile super(WebrecorderRunner, self).__init__(argres, rec_port=0) if not argres.no_browser: import webbrowser webbrowser.open_new(os.environ['APP_HOST'] + '/')
Example #2
Source File: web.py From svviz with MIT License | 6 votes |
def run(port=None): import webbrowser, threading if port is None: port = getRandomPort() # load() url = "http://127.0.0.1:{}/".format(port) logging.info("Starting browser at {}".format(url)) # webbrowser.open_new(url) threading.Timer(1.25, lambda: webbrowser.open(url) ).start() app.run( port=port#, # debug=True )
Example #3
Source File: wiki.py From azure-devops-cli-extension with MIT License | 6 votes |
def get_page(wiki, path, version=None, open=False, # pylint: disable=redefined-builtin include_content=False, organization=None, project=None, detect=None): """Get the content of a page or open a page. :param wiki: Name or Id of the wiki. :type wiki: str :param path: Path of the wiki page. :type path: str :param version: Version (ETag) of the wiki page. :type version: str :param include_content: Include content of the page. :type include_content: str :param open: Open the wiki page in your web browser. :type open: bool """ organization, project = resolve_instance_and_project(detect=detect, organization=organization, project=project) wiki_client = get_wiki_client(organization) page_object = wiki_client.get_page( wiki_identifier=wiki, project=project, path=path, recursion_level=None, version_descriptor=version, include_content=include_content) if open: webbrowser.open_new(url=page_object.page.remote_url) return page_object
Example #4
Source File: PlayerView.py From moviecatcher with MIT License | 6 votes |
def showDlLink (self, link) : window = tkinter.Toplevel() window.title('下载链接') window.resizable(width = 'false', height = 'false') if self.Tools.isWin() : window.iconbitmap(self.Tools.getRes('biticon.ico')) topZone = tkinter.Frame(window, bd = 0, bg="#444") topZone.pack(expand = True, fill = 'both') textZone = tkinter.Text(topZone, height = 8, width = 50, bd = 10, bg="#444", fg = '#ddd', highlightthickness = 0, selectbackground = '#116cd6') textZone.grid(row = 0, column = 0, sticky = '') textZone.insert('insert', link) dlBtn = tkinter.Button(topZone, text = '下载', width = 10, fg = '#222', highlightbackground = '#444', command = lambda url = link : webbrowser.open_new(url)) dlBtn.grid(row = 1, column = 0, pady = 5)
Example #5
Source File: commands.py From earthengine with MIT License | 6 votes |
def run(self, unused_args, unused_config): """Generates and opens a URL to get auth code, then retrieve a token.""" auth_url = ee.oauth.get_authorization_url() webbrowser.open_new(auth_url) print(""" Opening web browser to address %s Please authorize access to your Earth Engine account, and paste the resulting code below. If the web browser does not start, please manually browse the URL above. """ % auth_url) auth_code = input('Please enter authorization code: ').strip() token = ee.oauth.request_token(auth_code) ee.oauth.write_token(token) print('\nSuccessfully saved authorization token.')
Example #6
Source File: commands.py From aqua-monitor with GNU Lesser General Public License v3.0 | 6 votes |
def run(self, unused_args, unused_config): """Generates and opens a URL to get auth code, then retrieve a token.""" auth_url = ee.oauth.get_authorization_url() webbrowser.open_new(auth_url) print(""" Opening web browser to address %s Please authorize access to your Earth Engine account, and paste the resulting code below. If the web browser does not start, please manually browse the URL above. """ % auth_url) auth_code = input('Please enter authorization code: ').strip() token = ee.oauth.request_token(auth_code) ee.oauth.write_token(token) print('\nSuccessfully saved authorization token.')
Example #7
Source File: eurekatrees.py From EurekaTrees with MIT License | 6 votes |
def main(): parser = argparse.ArgumentParser(description='Parse a random forest') parser.add_argument('--trees', dest='trees', help='Path to file holding the trees.', required=True) parser.add_argument('--columns', dest='columns', default=None, help='Path to csv file holding column index and column name.') parser.add_argument('--output_path', dest='output_path', default='.', help='Path to outputted files.') args = parser.parse_args() column_name_dict = {} if args.columns: column_name_dict = read_columns(args.columns) trees = read_trees(args.trees) tree_list = [] for index, tree in enumerate(trees): tree_obj = Tree() tree_obj.create_tree(tree, column_name_dict) js_struct = tree_obj.get_js_struct(tree_obj.root) node_dict = {'tree': [js_struct], 'max_depth': tree_obj.max_depth, 'max_breadth': tree_obj.max_breadth} tree_list.append(node_dict) make_tree_viz(tree_list, args.output_path) webbrowser.open_new(os.path.join(args.output_path, 'home.html'))
Example #8
Source File: guiClass.py From Video-Downloader with GNU General Public License v2.0 | 6 votes |
def __menu (self) : menubar = Tkinter.Menu(self.master) fileMenu = Tkinter.Menu(menubar, tearoff = 0) fileMenu.add_command(label = "Config", command = self.__configPanel) fileMenu.add_command(label = "Close", command = self.master.quit) menubar.add_cascade(label = "File", menu = fileMenu) aboutMenu = Tkinter.Menu(menubar, tearoff = 0) aboutMenu.add_command(label = "Info", command = self.__showInfo) aboutMenu.add_command(label = "Check Update", command = self.__chkUpdate) menubar.add_cascade(label = "About", menu = aboutMenu) helpMenu = Tkinter.Menu(menubar, tearoff = 0) helpMenu.add_command(label = "GitHub", command = lambda target = self.gitUrl : webbrowser.open_new(target)) helpMenu.add_command(label = "Release Notes", command = lambda target = self.appUrl : webbrowser.open_new(target)) helpMenu.add_command(label = "Send Feedback", command = lambda target = self.feedUrl : webbrowser.open_new(target)) menubar.add_cascade(label = "Help", menu = helpMenu) self.master.config(menu = menubar)
Example #9
Source File: response.py From pledgeservice with Apache License 2.0 | 6 votes |
def showbrowser(self): """ Show this response in a browser window (for debugging purposes, when it's hard to read the HTML). """ import webbrowser import tempfile f = tempfile.NamedTemporaryFile(prefix='webtest-page', suffix='.html') name = f.name f.close() f = open(name, 'w') if PY3: f.write(self.body.decode(self.charset or 'ascii', 'replace')) else: f.write(self.body) f.close() if name[0] != '/': # pragma: no cover # windows ... url = 'file:///' + name else: url = 'file://' + name webbrowser.open_new(url)
Example #10
Source File: run_test.py From aswan with GNU Lesser General Public License v2.1 | 6 votes |
def coverage_html(): """ 将coverage结果放置到html中并自动打开浏览器 """ output_dir = os.path.join(os.getcwd(), 'coverage_output') if os.path.exists(output_dir): shutil.rmtree(output_dir) os.mkdir(output_dir) now_str = time.strftime("%Y%m%d%H%M") html_result_path = os.path.join(output_dir, now_str) html_cmd = 'coverage html -d {path}'.format(path=html_result_path) for test_file_path in find_test_file_paths(): coverage_cmd = "coverage run -a --source=risk_models,builtin_funcs {path}".format( path=test_file_path) os.system(coverage_cmd) os.system(html_cmd) os.remove(os.path.join(os.getcwd(), '.coverage')) webbrowser.open_new( 'file:///{base_dir}/index.html'.format(base_dir=html_result_path))
Example #11
Source File: UpdateInfoView.py From moviecatcher with MIT License | 6 votes |
def updateInfo (self) : if self.udInfo != [] : if self.udInfo['version'] != '' : version = str(self.udInfo['version']) else : version = str(self.app['ver']) + ' Build (' + str(self.app['build']) + ')' verlabel = tkinter.Label(self.frame, text = 'Version : ' + version, fg = '#ddd', bg="#444", font = ("Helvetica", "10"), anchor = 'center') verlabel.grid(row = 1, column = 1) self.information = tkinter.Text(self.frame, height = 8, width = 35, bd = 0, fg = '#ddd', bg="#222", highlightthickness = 1, highlightcolor="#111", highlightbackground = '#111', selectbackground = '#116cd6', font = ("Helvetica", "12")) self.information.grid(row = 2, column = 1, pady = 10) self.information.delete('0.0', 'end') self.information.insert('end', self.udInfo['msg']) btn = tkinter.Button(self.frame, text = 'Download', width = 10, fg = '#222', highlightbackground = '#444', command = lambda target = self.udInfo['dUrl'] : webbrowser.open_new(target)) btn.grid(row = 3, column = 1) else : self.timer = self.frame.after(50, self.updateInfo)
Example #12
Source File: main.py From thrain with MIT License | 5 votes |
def openparthlinkedin(event): webbrowser.open_new(r"https://in.linkedin.com/in/parth-trehan")
Example #13
Source File: start_flask.py From asreview with Apache License 2.0 | 5 votes |
def _open_browser(host, port): webbrowser.open_new(_url(host, port))
Example #14
Source File: main.py From thrain with MIT License | 5 votes |
def openhardiklinkedin(event): webbrowser.open_new(r"https://in.linkedin.com/in/hardik-gaur-135891122")
Example #15
Source File: menu.py From faceswap with GNU General Public License v3.0 | 5 votes |
def _build_recources_menu(self): """ Build resources menu """ # pylint: disable=cell-var-from-loop logger.debug("Building Resources Files menu") for resource in _RESOURCES: self.recources_menu.add_command( label=resource[0], command=lambda link=resource[1]: webbrowser.open_new(link)) logger.debug("Built resources menu")
Example #16
Source File: guiClass.py From Video-Downloader with GNU General Public License v2.0 | 5 votes |
def __chkUpdate (self) : Updater = updateClass.Update() info = Updater.check(self.appVer) self.slave = Tkinter.Tk(); self.slave.title('Update') self.slave.resizable(width = 'false', height = 'false') if info['update'] == True : label = Tkinter.Label(self.slave, text = info['version'], font = ("Helvetica", "16", 'bold'), anchor = 'center') label.grid(row = 0, pady = 10) information = Tkinter.Text(self.slave, height = 10, width = 60, highlightthickness = 0, font = ("Helvetica", "14")) information.grid(row = 1, padx = 10, pady = 5) information.insert('end', info['msg']); btn = Tkinter.Button(self.slave, text = 'Download', width = 10, command = lambda target = info['dUrl'] : webbrowser.open_new(target)) btn.grid(row = 2, pady = 10) else : label = Tkinter.Label(self.slave, text = self.version, font = ("Helvetica", "16", 'bold'), anchor = 'center') label.grid(row = 0, pady = 10) label = Tkinter.Label(self.slave, height = 3, width = 60, text = info['msg'], font = ("Helvetica", "14"), anchor = 'center') label.grid(row = 1, pady = 10) now = int(time.time()) self.CfgClass.lastUd(now)
Example #17
Source File: backend.py From smd with MIT License | 5 votes |
def linkGitHub(): if request.method == 'POST': webbrowser.open_new('https://github.com/artyshko/smd') return json.dumps( { 'status': True } )
Example #18
Source File: guiClass.py From Video-Downloader with GNU General Public License v2.0 | 5 votes |
def __autoUpdate (self) : now = int(time.time()) if self.cfg['udrate'] == 1: updateTime = int(self.cfg['udtime']) + 86400 elif self.cfg['udrate'] == 2: updateTime = int(self.cfg['udtime']) + 86400 * 7 elif self.cfg['udrate'] == 3: updateTime = int(self.cfg['udtime']) + 86400 * 30 else : updateTime = int(self.cfg['udtime']) + 86400 * 7 if updateTime < now : Updater = updateClass.Update() info = Updater.check(self.appVer) self.CfgClass.lastUd(now) if info['update'] == True : self.slave = Tkinter.Tk(); self.slave.title('Update') self.slave.resizable(width = 'false', height = 'false') label = Tkinter.Label(self.slave, text = info['version'], font = ("Helvetica", "16", 'bold'), anchor = 'center') label.grid(row = 0, pady = 10) information = Tkinter.Text(self.slave, height = 10, width = 60, highlightthickness = 0, font = ("Helvetica", "14")) information.grid(row = 1, padx = 10, pady = 5) information.insert('end', info['msg']); btn = Tkinter.Button(self.slave, text = 'Download', width = 10, command = lambda target = info['dUrl'] : webbrowser.open_new(target)) btn.grid(row = 2, pady = 10)
Example #19
Source File: backend.py From smd with MIT License | 5 votes |
def linkTelegram(): if request.method == 'POST': webbrowser.open_new('https://t.me/SpotifyMusicDownloaderBot') return json.dumps( { 'status': True } )
Example #20
Source File: Functions.py From opem with MIT License | 5 votes |
def description_control( Analysis_Name, Analysis_List, User_Input, Links_Dict, Vectors_Dict): """ Control each analysis description. :param Analysis_Name: analysis name :type Analysis_Name: str :param Analysis_List: analysis list :type Analysis_List: list :param User_Input: user input :type User_Input: str :param Links_Dict: documents links :type Links_Dict: dict :param Vectors_Dict: test vectors :type Vectors_Dict: dict :return: None """ if User_Input.upper() == "M": webbrowser.open_new(Links_Dict[Analysis_Name]) elif User_Input.upper() == "T": line() print(Analysis_Name + " Standard Test Vector\n") Test_Vector = Vectors_Dict[Analysis_Name] for i in Test_Vector.keys(): print(i + " : " + str(Test_Vector[i])) print("\n") line() input_temp = input("Press any key to continue") del input_temp Analysis_List[Analysis_Name]( InputMethod=Test_Vector, TestMode=True) else: Analysis_List[Analysis_Name]()
Example #21
Source File: main.py From thrain with MIT License | 5 votes |
def opengithub(event): webbrowser.open_new(r"https://github.com/parthendo/thrain")
Example #22
Source File: main.py From thrain with MIT License | 5 votes |
def recievefilepage(): webbrowser.open_new(r"http://127.0.0.1:5000/file-directory")
Example #23
Source File: main.py From thrain with MIT License | 5 votes |
def sendfilepage(): webbrowser.open_new(r"http://127.0.0.1:5000/upload-file")
Example #24
Source File: tickeys_tray.py From Tickeys-linux with MIT License | 5 votes |
def show_github_page(self, widget=None, data=None): webbrowser.open_new("https://github.com/BillBillBillBill/Tickeys-linux")
Example #25
Source File: gpcharts.py From GooPyCharts with Apache License 2.0 | 5 votes |
def wb(self): self.write() webbrowser.open_new(self.fname) #typical line chart plot
Example #26
Source File: executable.py From sublime-text-trello with MIT License | 5 votes |
def open_in_browser(self): webbrowser.open_new(self.trello_element.url)
Example #27
Source File: cli.py From telepresence with Apache License 2.0 | 5 votes |
def report_crash(error: Any, log_path: str, logs: str) -> None: print( "\nLooks like there's a bug in our code. Sorry about that!\n\n" + error + "\n" ) if log_path != "-": log_ref = " (see {} for the complete logs):".format(log_path) else: log_ref = "" if "\n" in logs: print( "Here are the last few lines of the logfile" + log_ref + "\n\n" + "\n".join(logs.splitlines()[-12:]) + "\n" ) report = "no" if sys.stdout.isatty(): message = ( "Would you like to file an issue in our issue tracker?" " You'll be able to review and edit before anything is" " posted to the public." " We'd really appreciate the help improving our product. [Y/n]: " ) try: report = input(message).lower()[:1] except EOFError: print("(EOF)") if report in ("y", ""): url = "https://github.com/datawire/telepresence/issues/new?body=" body = quote_plus( BUG_REPORT_TEMPLATE.format( sys.argv, telepresence.__version__, sys.version, safe_output(["kubectl", "version", "--short"]), safe_output(["oc", "version"]), safe_output(["uname", "-a"]), error, logs[-1000:], )[:4000] ) # Overly long URLs won't work webbrowser.open_new(url + body)
Example #28
Source File: marketplace.py From catalyst with Apache License 2.0 | 5 votes |
def sign_transaction(self, tx): url = 'https://legacy.mycrypto.com/#offline-transaction' print('\nVisit {url} and enter the following parameters:\n\n' 'From Address:\t\t{_from}\n' '\n\tClick the "Generate Information" button\n\n' 'To Address:\t\t{to}\n' 'Value / Amount to Send:\t{value}\n' 'Gas Limit:\t\t{gas}\n' 'Gas Price:\t\t[Accept the default value]\n' 'Nonce:\t\t\t{nonce}\n' 'Data:\t\t\t{data}\n'.format( url=url, _from=tx['from'], to=tx['to'], value=tx['value'], gas=tx['gas'], nonce=tx['nonce'], data=tx['data'], ) ) webbrowser.open_new(url) signed_tx = input('Copy and Paste the "Signed Transaction" ' 'field here:\n') if signed_tx.startswith('0x'): signed_tx = signed_tx[2:] return signed_tx
Example #29
Source File: Show.py From wavectl with Apache License 2.0 | 5 votes |
def showResourcesInBrowser(self, rsrcs): """ Depending on the command line arguments and the number of selected resources , display the resources in a web browser. The user must specify --in-browser in the command line for us to launch a browser and the number of resources to display should be less than _maxBrowserTabs. We do not want to create 100's of tabs programmatically by accident""" if len(rsrcs) == 0: return if len(rsrcs) > ShowCommand._maxBrowserTabs(): raise ShowError( "Too many resources to display in browser. Selected " + "resrouces: {0}, maximum supported {1}" "".format( len(rsrcs), ShowCommand._maxBrowserTabs)) # Open the first resource in a new window. # Then open the rest of the resources in tabs. # TODO: The python documentation does not guarantee the new window # and tab usage. All new pages can be opened in new tabs. rsrc = rsrcs[0] urlPrefix = self.getWavefrontHost() webbrowser.open_new(urlPrefix + rsrc.browserUrlSuffix()) for rsrc in rsrcs[1:]: webbrowser.open_new_tab(urlPrefix + rsrc.browserUrlSuffix())
Example #30
Source File: __main__.py From git-gud with MIT License | 5 votes |
def handle_issues(self, args): issues_website = "https://github.com/benthayer/git-gud/issues" webbrowser.open_new(issues_website)