示例#1
0
    def createAccessTokenReplacement(self):
        """
        Creates an access token by getting an auth code from the user and exchanging it with the server.
        This method will also save a token to the file specified in your config. You should not ever need to call this
        method. Instead call getAccessToken()

        >>>createAccessToken()
        <OAuth2.handleAccessToken.handleAccessToken object>

        This method may abort the python script if it cannot create a token object.
        This will happen when we get a non token response from the server e.g. a 400 from an invalid client
        """

        url = self._config['OAUTH2ENDPOINT']['huddleAuthServer'] + "request?response_type=code" + \
                        "&client_id=" + self._config['OAUTH2']['clientID'] + \
                        "&redirect_uri=" + self._config['OAUTH2']['redirectUri']
        webbrowser.open_new(url)
        code = input('Please enter the code from your web browser:')

        response = self._oauth.obtainAccessTokenBy3LeggedOAuth(code)
        responseBody = json.loads(response['Body'])

        try:
            oauthToken = Token(responseBody)
        except TypeError as e:
            print ("Bad response when requesting a token " + str(response))
            sys.exit()

        return oauthToken
示例#2
0
    def __reportBug(self, event):
        fields = {}
        fields['app_id'] = ccpublisher.const.REPORTING_APP
        fields['app_version'] = ccpublisher.const.version()
        fields['title'] = wx.xrc.XRCCTRL(self.__reportDlg, "TXT_TITLE").GetValue()
        fields['platform'] = platform.platform()
        if (wx.xrc.XRCCTRL(self.__reportDlg, "CMB_TYPE").GetStringSelection().lower() == "bug report"):
            fields['priority'] = "bug"
        else:
            fields['priority'] = "wish"
            
        fields['message'] = wx.xrc.XRCCTRL(self.__reportDlg, "TXT_BODY").GetValue()
        
        bugUrl = libfeedback.comm.sendReport(ccpublisher.const.REPORTING_URL, fields)
        if bugUrl is not None:
            result = wx.MessageDialog(None, "Your crash report has been sent.\n"
                  "You can track your report at\n"
                  "%s\n\nDo you want to open this page in your browser now?" % bugUrl,
                  caption="ccPublisher: Report Sent",
                  style=wx.YES|wx.NO).ShowModal()
                  
            if result == wx.ID_YES:
                # open the web browser
                webbrowser.open_new(bugUrl)
        else:
            # XXX Show yet-another-error here 
            # and humbly provide a way to submit a report manually
            pass

        self.__reportDlg.Close()
        del self.__reportDlg
示例#3
0
 def x(result):
     if result != -1:
         fn = options[result][1]
         if fn.endswith('.java'):
             self.window.open_file(fn)
         else:
             webbrowser.open_new(fn)
示例#4
0
 def openweb(self, *args):
     """
     Open wikipedia url
     """
     url = self.main.url_to_open
     if url:
         webbrowser.open_new(url)
示例#5
0
 def reportBug(self, event):
     # open the browser window to the New Issue tracker page
     webbrowser.open_new("http://roundup.creativecommons.org/ccpublisher/issue?@template=item")
     
     return
 
     
     # load the dialog definition
     xrc_resource = wx.xrc.XmlResource(os.path.join(
         p6.api.getResourceDir(), 'dialogs.xrc'))
     report = xrc_resource.LoadDialog(None, "DLG_BUGREPORT")
     
     # connect the OK button
     self.Bind(wx.EVT_BUTTON,
               self.__reportBug,
               id = wx.xrc.XRCID("CMD_OK")
               )
     
     # connect the Cancel button
     self.Bind(wx.EVT_BUTTON,
               lambda event: report.Close(),
               id = wx.xrc.XRCID("CMD_CANCEL")
               )
               
     # display the dialog
     self.__reportDlg = report
     report.ShowModal()
示例#6
0
def helpdesk():
    """Open the NEST helpdesk in browser.

    Use the system default browser.

    KEYWORDS: info
    """

    if sys.version_info < (2, 7, 8):
        print("The NEST helpdesk is only available with Python 2.7.8 or "
              "later. \n")
        return

    if 'NEST_DOC_DIR' not in os.environ:
        print(
            'NEST help needs to know where NEST is installed.'
            'Please source nest_vars.sh or define NEST_DOC_DIR manually.')
        return

    helpfile = os.path.join(os.environ['NEST_DOC_DIR'], 'help',
                            'helpindex.html')

    # Under Windows systems webbrowser.open is incomplete
    # See <https://bugs.python.org/issue8232>
    if sys.platform[:3] == "win":
        os.startfile(helpfile)

    # Under MacOs we need to ask for the browser explicitly.
    # See <https://bugs.python.org/issue30392>.
    if sys.platform[:3] == "dar":
        webbrowser.get('safari').open_new(helpfile)
    else:
        webbrowser.open_new(helpfile)
示例#7
0
    def view_cdn_in_browser(self):
        """
        Let's prove that we've successfully cached the object on the CDN by
        opening {object_name} on the CDN: http://{bucket_name}.{alias}.netdna-cdn.com/{object_name}
        """

        webbrowser.open_new("http://%s/%s" % (self.cdn_url, self.object_name))
示例#8
0
  def run_browser(self, html_file, message, expectedResult=None):
    if expectedResult is not None:
      try:
        queue = multiprocessing.Queue()
        server = multiprocessing.Process(target=functools.partial(server_func, self.get_dir()), args=(queue,))
        server.start()
        self.harness_queue.put('http://localhost:8888/' + html_file)
        output = '[no http server activity]'
        start = time.time()
        while time.time() - start < 60:
          if not queue.empty():
            output = queue.get()
            break
          time.sleep(0.1)

        self.assertIdentical(expectedResult, output)
      finally:
        server.terminate()
        time.sleep(0.1) # see comment about Windows above
    else:
      webbrowser.open_new(os.path.abspath(html_file))
      print 'A web browser window should have opened a page containing the results of a part of this test.'
      print 'You need to manually look at the page to see that it works ok: ' + message
      print '(sleeping for a bit to keep the directory alive for the web browser..)'
      time.sleep(5)
      print '(moving on..)'
示例#9
0
def fetch_train_tickets(from_station, to_station, date=None, train_type=None):
    """get input data and print final result

    :param train_type
    :param from_station
    :param to_station
    :param date
    :return: if data is invalidate then return False
    """
    date = tickets_util.validate_raw_date(date)

    if not isinstance(date, str):
        print(common_util.make_colorful_font(date['message'], Fore.RED))
        return date['result']

    from_station_key = tickets_util.get_station_key(from_station)
    to_station_key = tickets_util.get_station_key(to_station)

    fetch_url = URL.format(date=date, from_station_key=from_station_key, to_station_key=to_station_key)
    train_tickets = fetch_trains.TrainTickets(fetch_url)
    tickets_result = train_tickets.fetch_tickets()

    # with open('./data/tickets_data.json', encoding="utf-8") as f:
    #     tickets_result = json.loads(f.read())

    if tickets_result['result']:
        print_train_tickets(tickets_result['data'], train_type)
    else:
        print(common_util.make_colorful_font(tickets_result['message'], Fore.RED))
        return False
    determine_input = input('到官网购票? y/n ')
    if determine_input == 'y':
        webbrowser.open_new(OFFICIAL_WEB)
示例#10
0
	def __init__(self,gladefile,installpath,filename):
		
		devede_executor.executor.__init__(self)
		self.printout=False
		
		if (sys.platform=="win32") or (sys.platform=="win64"):
			webbrowser.open_new(os.path.join(installpath, filename))
			return

		self.printout=False

		launch_list=[[True,"yelp"],[False,"epiphany"],[False,"konqueror"],[False,"firefox","-new-window"],[False,"opera","-newwindow"]]

		file=os.path.join(installpath,"html",filename)	
		
		for program in launch_list:
			if program[0]:
				program.append("file://"+file)
			else:
				program.append(file)
			retval=self.launch_program(program[1:],80,False)
			if retval!=None:
				break
			
		if retval==None:
			msg=devede_dialogs.show_error(gladefile,_("Can't open the help files."))
示例#11
0
 def setUpClass(self):
   super(BrowserCore, self).setUpClass()
   self.harness_queue = multiprocessing.Queue()
   self.harness_server = multiprocessing.Process(target=harness_server_func, args=(self.harness_queue,))
   self.harness_server.start()
   print '[Browser harness server on process %d]' % self.harness_server.pid
   webbrowser.open_new('http://localhost:9999/run_harness')
示例#12
0
    def authorize(self):
        """ Does the OAuth conga. Opens browser window so that the user can authenticate.

        Returns: access_token, for further unattended use
        """
        oauth_request = oauth.OAuthRequest.from_consumer_and_token(
            self.client.consumer, http_url=self.client.request_token_url, http_method="POST"
        )
        oauth_request.sign_request(self.client.signature_method_plaintext, self.client.consumer, None)
        token = self.client.fetch_request_token(oauth_request)

        # Authorize access, get verifier
        url = self.client.authorize_token(oauth_request)
        webbrowser.open_new(url)

        verifier = raw_input("Please enter verifier:")

        # Now obtain access_token
        oauth_request = oauth.OAuthRequest.from_consumer_and_token(
            self.client.consumer, token=token, verifier=verifier, http_url=self.client.access_token_url
        )
        oauth_request.sign_request(self.client.signature_method_plaintext, self.client.consumer, token)
        token = self.client.fetch_access_token(oauth_request)

        self.access_token = token
        return self.access_token
示例#13
0
def get_new_vk_token():
    SocketServer.TCPServer.allow_reuse_address = True
    httpd = None
    redirect_port = 20938
    while httpd is None:
        try:
            httpd = SocketServer.TCPServer(("", redirect_port), HttpHandler)
            print 'Server is running on port %d.' % redirect_port
        except socket.error:
            print 'Port %d is already in use. Trying next port.' % redirect_port
            redirect_port += 1

    parameters = {
        'client_id': APP_ID,
        'scope': 'audio',
        'redirect_uri': 'http://localhost:%d' % redirect_port,
        'display': 'page',
        'v': 5.37,
        'response_type': 'token'
    }
    auth_url = "https://oauth.vk.com/authorize?{}".format(urlencode(parameters))

    webbrowser.open_new(auth_url)

    httpd.handle_request()
    httpd.handle_request()
    token_object = dict()
    token_object['access_token'] = TOKEN['#access_token'][0]
    token_expires_in = int(TOKEN['expires_in'][0])
    token_object['expiring_time'] = int(time.time()) + token_expires_in - 60
    return token_object
示例#14
0
    def go_to_button(self, sender, e):

        if self.user_data["name_url"]:
            if spk_page in self.user_data["name_url"]:
                webbrowser.open_new(self.user_data["name_url"])
        else:
            webbrowser.open_new(spk_page + "/my-cloud")
示例#15
0
def report_dispatcher(args=sys.argv[1:]):
    """Parses command line and calls the different report functions

    """

    command = command_handling(args, COMMAND_LOG)

    # Parses command line arguments.
    command_args = a.parse_and_check(command)

    port = DEFAULT_PORT if not command_args.port else command_args.port
    report_url = get_report_url(command_args)
    if not command_args.no_server:
        absolute_report_url = "http://%s:%s/%s" % (DEFAULT_HOST, port, report_url)
        current_directory = os.getcwd()
        os.chdir(os.path.join(HOME, SERVER_DIRECTORY))
        httpd = None
        try:
            httpd = StoppableHTTPServer((DEFAULT_HOST, port), SimpleHTTPServer.SimpleHTTPRequestHandler)
            thread.start_new_thread(httpd.serve, ())
        except socket.error, exc:
            print exc
        # Open URL in new browser window
        webbrowser.open_new(absolute_report_url)
        # opens in default browser
        if httpd:
            raw_input(
                "*********************************\n"
                "Press <RETURN> to stop the server\n"
                "*********************************\n"
            )
        os.chdir(current_directory)
        if httpd:
            httpd.stop()
示例#16
0
def ooniprobe(reactor):
    from ooni.ui.cli import runWithDaemonDirector, runWithDirector
    from ooni.ui.cli import setupGlobalOptions, initializeOoniprobe
    from ooni.settings import config

    global_options = setupGlobalOptions(logging=True, start_tor=True,
                                        check_incoherences=True)
    if global_options['info']:
        config.log_info()
        return defer.succeed(None)

    if global_options['queue']:
        return runWithDaemonDirector(global_options)

    if global_options['web-ui']:
        from ooni.settings import config
        from ooni.scripts.ooniprobe_agent import status_agent, start_agent
        if status_agent() != 0:
            p = Process(target=start_agent)
            p.start()
            p.join()
            print("Started ooniprobe-agent")
        webbrowser.open_new(config.web_ui_url)
        return defer.succeed(None)

    if global_options['initialize']:
        initializeOoniprobe(global_options)
        return defer.succeed(None)

    return runWithDirector(global_options)
示例#17
0
    def do_lexhtml(self, subcmd, opts, lang, path):
        """${cmd_name}: lex the given file to styled HTML (for debugging)

        ${cmd_usage}
        ${cmd_option_list}
        """
        from ludditelib.debug import lex_to_html
        content = open(path, 'r').read()
        html = lex_to_html(content, lang)

        if opts.output == '-':
            output_path = None
            output_file = sys.stdout
        else:
            if opts.output:
                output_path = opts.output
            else:
                output_path = path+".html"
            if exists(output_path):
                os.remove(output_path)
            output_file = open(output_path, 'w')
        if output_file:
            output_file.write(html)
        if output_path:
            output_file.close()

        if opts.browse:
            if not output_path:
                raise LudditeError("cannot open in browser if stdout used "
                                   "for output")
            import webbrowser
            url = _url_from_local_path(output_path)
            webbrowser.open_new(url)            
示例#18
0
    def startAuthorizationFlow(self) -> None:
        Logger.log("d", "Starting new OAuth2 flow...")

        # Create the tokens needed for the code challenge (PKCE) extension for OAuth2.
        # This is needed because the CuraDrivePlugin is a untrusted (open source) client.
        # More details can be found at https://tools.ietf.org/html/rfc7636.
        verification_code = self._auth_helpers.generateVerificationCode()
        challenge_code = self._auth_helpers.generateVerificationCodeChallenge(verification_code)

        # Create the query string needed for the OAuth2 flow.
        query_string = urlencode({
            "client_id": self._settings.CLIENT_ID,
            "redirect_uri": self._settings.CALLBACK_URL,
            "scope": self._settings.CLIENT_SCOPES,
            "response_type": "code",
            "state": "(.Y.)",
            "code_challenge": challenge_code,
            "code_challenge_method": "S512"
        })

        # Open the authorization page in a new browser window.
        webbrowser.open_new("{}?{}".format(self._auth_url, query_string))

        # Start a local web server to receive the callback URL on.
        self._server.start(verification_code)
示例#19
0
	def __init__(self):
		import ConfigParser
		parser = ConfigParser.RawConfigParser()
		parser.read('plugins/GoogleDocsFSPlugin.cfg')
		self.client_id = parser.get('API Keys', 'client_id')
		self.client_secret = parser.get('API Keys', 'client_secret')
		self.redirect_uri = parser.get('API Keys', 'redirect_uri')
		
		params = urllib.urlencode({
			'client_id' : self.client_id,
			'redirect_uri' : self.redirect_uri,
			'response_type' : 'code'
		})
		
		import webbrowser
		webbrowser.open_new('{0}?{1}&scope={2}'.format(OAUTH_AUTH_URL, params, DOCS_SCOPE))
		self.refresh_token = raw_input('Enter access code: ')
		self.getToken(False)

		import time
		self.refresh_time = 0

		self.files = dict()
		self.cache_dir = '/tmp/dwfs-' + getpass.getuser()
		self.cache = GoogleDocsCache()
示例#20
0
def displayhelp(htmlfile,txtfile, helpname=None):
    """Open a browser with the html help file, failing that bring up
       a dialog with the help as a text file, or as a last resort direct
       the user to the online documentation.
    """

    #This holds the title for the widget
    if not helpname:
        helpname="CCP1GUI help"
        
    if sys.platform[:3] == 'win':
        txtpath = gui_path + '\\doc\\'
        htmlpath = gui_path+ '\\doc\\html\\'
    elif  sys.platform[:3] == 'mac':
        pass
    else:
        txtpath = gui_path + '/doc/'
        htmlpath =  gui_path + '/doc/html/'

    htmlfound = None
    browserr = None

    if validpath(htmlpath+htmlfile):
        #Check for file as no way of checking with webrowser
        htmlfound = 1
        try:
            url = "file://"+htmlpath+htmlfile
            webbrowser.open_new(url)
        except webbrowser.Error, (errno,msg):
            print "Browser Error: %s (%d)\n" % (msg,errno)
            print "Using widget instead."
            browserr = 1
示例#21
0
def firefox(url=None, urls=[]):
    """
    firefox(urls=[ "http://google.com", "http://news.google.com"])

    be sure to pass urls in with the http:// prefix

    i.e.
    "http://www.google.com" is good
    "google.com" is not good

    http://stackoverflow.com/questions/832331/launch-a-webpage-on-a-firefox-win-tab-using-python
    Thanks Nadia!

    http://docs.python.org/library/webbrowser.html

    firefoxes "Preferences->Tab" seem to override anything done here

    *2011.08.31 08:29:51
    for more advanced browser control, see Selenium and Webdriver
    examples available as site scrape code

    """
    import webbrowser
    #print url
    if url is not None:
        webbrowser.open_new(url)
    elif urls:
        url = urls.pop(0)
        #webbrowser.open(url, new=1)
        webbrowser.open_new(url)
        for u in urls:
            webbrowser.open_new_tab(u)
示例#22
0
 def run(self):
     view_id = sublime.active_window().active_view().id()
     if not issue_obj_storage.empty():
         issue_obj = utils.show_stock(issue_obj_storage, view_id)
         url = issue_obj["issue"]["html_url"]
         if url:
             webbrowser.open_new(url)
示例#23
0
def getKey(YD_APP_ID, YD_APP_SECRET, keyfile):
    if os.path.isfile(keyfile):
        return open(keyfile, 'r').read()
    import webbrowser
    webbrowser.open_new(
        OAYR + 'authorize?response_type=code&client_id=' + YD_APP_ID)

    YploadRequestHandler._code = None
    httpd = BaseHTTPServer.HTTPServer(('', 8714), YploadRequestHandler)
    httpd.handle_request()

    if YploadRequestHandler._code:
        code = YploadRequestHandler._code
    else:
        code = raw_input('Input your code: ').strip()

    res = requests.post(OAYR + 'token', data=dict(
        grant_type='authorization_code',
        code=code,
        client_id=YD_APP_ID, client_secret=YD_APP_SECRET
    ))
    if res.status_code != 200:
        raise Exception('Wrong code')
    key = res.json['access_token']
    with open(keyfile, 'w') as fl:
        fl.write(key)
    return key
示例#24
0
    def prepare_run(self, workspace):
        '''Invoke the image_set_list pickling mechanism and save the pipeline'''

        pipeline = workspace.pipeline
        image_set_list = workspace.image_set_list

        if pipeline.test_mode or self.from_old_matlab:
            return True
        if self.batch_mode.value:
            self.enter_batch_mode(workspace)
            return True
        else:
            path = self.save_pipeline(workspace)
            if not cpprefs.get_headless():
                import wx
                wx.MessageBox(
                        "CreateBatchFiles saved pipeline to %s" % path,
                        caption="CreateBatchFiles: Batch file saved",
                        style=wx.OK | wx.ICON_INFORMATION)
            if self.go_to_website:
                try:
                    import webbrowser
                    import urllib
                    server_path = self.alter_path(os.path.dirname(path))
                    query = urllib.urlencode(dict(data_dir=server_path))
                    url = cpprefs.get_batchprofiler_url() + \
                          "/NewBatch.py?" + query
                    webbrowser.open_new(url)
                except:
                    import traceback
                    traceback.print_exc()
            return False
    def authorize(self, account):
        self.account = account

        if account == "twitter":
            self.api = self.TWITTER
        elif account == "identi.ca":
            self.api = self.IDENTICA
        else:
            self.api = self.GETGLUE

        self.request_token = None

        key = base64.b64decode(self.api["key"])
        secret = base64.b64decode(self.api["secret"])

        self.consumer = oauth.Consumer(key, secret)
        client = oauth.Client(self.consumer, proxy_info=self.proxy_info)

        resp, content = client.request(self.api["request_token"])

        if resp["status"] != "200":
            self.note_label.set_text(content)
            return False

        self.request_token = dict(urlparse.parse_qsl(content))

        url = "%s?oauth_token=%s" % (self.api["authorization"], self.request_token["oauth_token"])
        self.note_label.set_markup("Opening authorize link in default web browser.")
        webbrowser.open_new(url)
        return True
示例#26
0
    def make(self):
        helper_in_cwd = exists(join(self.dir, "googlecode_upload.py"))
        if helper_in_cwd:
            sys.path.insert(0, self.dir)
        try:
            import googlecode_upload
        except ImportError:
            raise MkError("couldn't import `googlecode_upload` (get it from http://support.googlecode.com/svn/trunk/scripts/googlecode_upload.py)")
        if helper_in_cwd:
            del sys.path[0]

        ver = _get_version()
        sdist_path = join(self.dir, "dist", "go-%s.zip" % ver)
        status, reason, url = googlecode_upload.upload_find_auth(
            sdist_path,
            "go-tool", # project_name
            "go %s source package" % ver, # summary
            ["Featured", "Type-Archive"]) # labels
        if not url:
            raise MkError("couldn't upload sdist to Google Code: %s (%s)"
                          % (reason, status))
        self.log.info("uploaded sdist to `%s'", url)

        project_url = "http://code.google.com/p/go-tool/"
        import webbrowser
        webbrowser.open_new(project_url)
示例#27
0
def URL_click(event):
    if not len(listbox.curselection()) == 0:
        currentPackage = packageDescription()
        for package in allPackages:
            if package.name ==listbox.get(listbox.curselection()):
                currentPackage = package
        webbrowser.open_new(currentPackage.homepage)
示例#28
0
def publish(connection, document, bucket, theme, prefix=None, title=None):
    bucket = connection.get_bucket(bucket)

    key_name = document.name

    if '.' in key_name:
        key_name = key_name.rsplit('.', 1)[0] + '.html'
    if '/' in key_name:
        key_name = key_name.rsplit('/', 1)[1]

    if prefix:
        key_name = '%s/%s' % (prefix, key_name)

    content = __template__ % {
        'title': title if title else key_name,
        'content': document.read(),
        'theme': theme
    }

    key = bucket.new_key(key_name)
    key.content_type = 'text/html'
    key.set_contents_from_string(content)
    key.set_canned_acl('public-read')

    public_url = key.generate_url(0, query_auth=False, force_http=True)

    os.system('echo "%s" | pbcopy' % public_url)
    webbrowser.open_new(public_url)
示例#29
0
def on_decide_policy(view, decision, dtype):
    uri = decision.get_request().get_uri()
    if uri.startswith("http") and not '127.0.0.1' in uri:
        decision.ignore()
        webbrowser.open_new(uri)
        return True
    return False
def check_credentials():
    """
    Check credentials and spawn server and browser if not
    """
    credentials = get_credentials()
    if not credentials or "https://www.googleapis.com/auth/drive" not in credentials.config["google"]["scope"]:
        try:
            with open(os.devnull, "w") as fnull:
                print "Credentials were not found or permissions were not correct. Automatically opening a browser to authenticate with Google."
                gunicorn = find_executable("gunicorn")
                process = subprocess.Popen(
                    [gunicorn, "-b", "127.0.0.1:8888", "app:wsgi_app"], stdout=fnull, stderr=fnull
                )
                webbrowser.open_new("http://127.0.0.1:8888/oauth")
                print "Waiting..."
                while not credentials:
                    try:
                        credentials = get_credentials()
                        sleep(1)
                    except ValueError:
                        continue
                print "Successfully authenticated!"
                process.terminate()
        except KeyboardInterrupt:
            print "\nCtrl-c pressed. Later, skater!"
            exit()
def openHelp() -> None:
    webbrowser.open_new(
        "https://github.com/martinet101/SomePythonThings-Zip-Manager/wiki")
示例#32
0
def refresh_gui():
    global response
    global used_tools_counter
    used_tools_counter = 1

    current_save.configure(state='disabled')
    gui_toggle.configure(state='disabled')
    for widget in widget_order:
        widget.configure(state='disabled')

    thread = Thread(target=crawl)
    thread.start()

    while (thread.is_alive()):
        current_save.configure(text='Checking for updates·..')
        root.update()
        time.sleep(0.15)
        current_save.configure(text='Checking for updates.·.')
        root.update()
        time.sleep(0.15)
        current_save.configure(text='Checking for updates..·')
        root.update()
        time.sleep(0.15)
        current_save.configure(text='Checking for updates...')
        for _ in range(10):
            root.update()
            time.sleep(0.15)

    response = mt_queue.get()

    update_gui('aim', aim_parser)
    update_gui('atola', atola_parser)
    update_gui('autopsy', autopsy_parser)
    update_gui('axiom', axiom_parser)
    update_gui('bec', bec_parser)
    update_gui('blacklight', blacklight_parser)
    update_gui('caine', caine_parser)
    update_gui('cyberchef', cyberchef_parser)
    update_gui('deft', deft_parser)
    update_gui('eift', eift_parser)
    update_gui('encase', encase_parser)
    update_gui('exiftool', exiftool_parser)
    update_gui('ez_amcacheparser', ez_amcacheparser_parser)
    update_gui('ez_appcompatcacheparser', ez_appcompatcacheparser_parser)
    update_gui('ez_bstrings', ez_bstrings_parser)
    update_gui('ez_evtxex', ez_evtxex_parser)
    update_gui('ez_jlecmd', ez_jlecmd_parser)
    update_gui('ez_jumplistex', ez_jumplistex_parser)
    update_gui('ez_lecmd', ez_lecmd_parser)
    update_gui('ez_mftecmd', ez_mftecmd_parser)
    update_gui('ez_mftexplorer', ez_mftexplorer_parser)
    update_gui('ez_pecmd', ez_pecmd_parser)
    update_gui('ez_rbcmd', ez_rbcmd_parser)
    update_gui('ez_recentfilecacheparser', ez_recentfilecacheparser_parser)
    update_gui('ez_registryex', ez_registryex_parser)
    update_gui('ez_sdbex', ez_sdbex_parser)
    update_gui('ez_shellbagex', ez_shellbagex_parser)
    update_gui('ez_timelineex', ez_timelineex_parser)
    update_gui('ez_vscmount', ez_vscmount_parser)
    update_gui('ez_wxtcmd', ez_wxtcmd_parser)
    update_gui('fec', fec_parser)
    update_gui('forensicexplorer', forensicexplorer_parser)
    update_gui('ffn', ffn_parser)
    update_gui('ftk', ftk_parser)
    update_gui('ftkimager', ftkimager_parser)
    update_gui('hashcat', hashcat_parser)
    update_gui('hstex', hstex_parser)
    update_gui('irec', irec_parser)
    update_gui('ive', ive_parser)
    update_gui('macquisition', macquisition_parser)
    update_gui('mobiledit', mobiledit_parser)
    update_gui('mountimagepro', mountimagepro_parser)
    update_gui('netanalysis', netanalysis_parser)
    update_gui('nirsoft', nirsoft_parser)
    update_gui('nsrl', nsrl_parser)
    update_gui('osf', osf_parser)
    update_gui('oxygen', oxygen_parser)
    update_gui('paraben', paraben_parser)
    update_gui('passware', passware_parser)
    update_gui('physicalanalyzer', physicalanalyzer_parser)
    update_gui('sleuthkit', sleuthkit_parser)
    update_gui('ufed4pc', ufed4pc_parser)
    update_gui('usbdetective', usbdetective_parser)
    update_gui('veracrypt', veracrypt_parser)
    update_gui('xamn', xamn_parser)
    update_gui('xways', xways_parser)

    ### Forensic Version Checker
    try:
        soup = BeautifulSoup(response[0].text, 'html.parser')
        version = soup.find('div', {
            'class': 'release-header'
        }).select_one('a').text.strip()
        version = version.replace('v', '')
    except:
        version = '1.11'
    if version != '1.11':
        about.configure(text='Update FVC', fg='blue', cursor='hand2')
        about.bind(
            '<ButtonRelease-1>', lambda e: webbrowser.open_new(
                'https://github.com/jankais3r/Forensic-Version-Checker/releases/latest'
            ))

    current_save.configure(text='Save', state='normal')
    gui_toggle.configure(state='normal')

    for widget in widget_order:
        widget.configure(state='normal')
示例#33
0
 def open_url(self, url):
     import webbrowser
     webbrowser.open_new(url)
示例#34
0
文件: ui.py 项目: DrSwagsalot/chgSubs
 def downloadLink(self):
     self.dlLabel = Label(self.labelFrameMKVTool, text = "Click Here to download MKVToolNix", font="TkDefaultFont 7 underline", fg = "blue", cursor = "hand2")
     self.dlLabel.grid(column = 0, row = 1, padx = 5, sticky = "NW")
     self.dlLabel.bind("<Button-1>", lambda e: webbrowser.open_new("https://www.fosshub.com/MKVToolNix.html"))
def OpenUrl(opt=''):
    if opt == 'issue':
        webbrowser.open_new('https://github.com/eoakley/artifacthelper/issues')
    else:
        webbrowser.open_new('https://github.com/eoakley/artifacthelper')
示例#36
0
 def Open_Homework(self, url):
     '''
     调用浏览器打开url
     :return: 
     '''
     webbrowser.open_new(url)
示例#37
0
def update():
    url = config.LATEST_RELEASE_URL if config.FROZEN else config.APP_URL
    webbrowser.open_new(url)
示例#38
0
# 지도 시각화 작업 모듈
import webbrowser
#  html 을 바로 실행시켜 주는 모듈
############
map = folium.Map(location=[37.5502, 126.982], zoom_start=11)
# 먼저 맵 객체를 생성 기분 위치를 지정해주고, 어느정도 확대할 것인지를 설정.

# 로드된 지도위에 각 경찰서 위치를 marking
for n in crime_anal_raw.index:
    folium.Marker([crime_anal_raw['lat'][n],
                   crime_anal_raw['lng'][n]]).add_to(map)

# 저장.
map
map.save('folium_kr.html')
webbrowser.open_new("folium_kr.html")

################
# 지도를 이용한 시각화 작업을 위해 지도의 중심 좌표를 이용하여 12배 확대
map = folium.Map(location=[37.5502, 126.982], zoom_start=12)

# 로드된 지도 위에 각 경찰서의 검거율을 x10 배수의 크기(반지름)로 원을 그려준다.(외경 선과 내면 색 지정)
# .add_to()함수로 불러온 map 에 더해줌
for n in crime_anal_raw.index:
    folium.CircleMarker([crime_anal_raw['lat'][n], crime_anal_raw['lng'][n]],
                        radius=crime_anal_raw['검거'][n] * 10,
                        color='#3186cc',
                        fill_color='#3186cc',
                        fill=True).add_to(map)

# map html파일로 저장 후 열기
示例#39
0
                ids = daisy.open_ds(f, graph + '-ids').data
                loc = daisy.open_ds(f, graph + '-locations').data
            except:
                loc = daisy.open_ds(f, graph).data
                ids = None
            dims = loc.shape[-1]
            loc = loc[:].reshape((-1, dims))
            if ids is None:
                ids = range(len(loc))
            for i, l in zip(ids, loc):
                if dims == 2:
                    l = np.concatenate([[0], l])
                graph_annotations.append(
                    neuroglancer.EllipsoidAnnotation(
                        center=l[::-1],
                        radii=(5, 5, 5),
                        id=i))
            graph_layer = neuroglancer.AnnotationLayer(
                annotations=graph_annotations,
                voxel_size=(1, 1, 1))

            with viewer.txn() as s:
                s.layers.append(name='graph', layer=graph_layer)

url = str(viewer)
print(url)
if os.environ.get("DISPLAY") and not args.no_browser:
    webbrowser.open_new(url)

print("Press ENTER to quit")
input()
def main():
    '''
    if you want to use this api,you should follow steps follows to operate.
    '''
    try:
        # step 1 : sign a app in weibo and then define const app key,app srcret,redirect_url
        APP_KEY = '4012287685'
        APP_SECRET = '6ef8902dc29f227b99bea31f79201875'
        REDIRECT_URL = 'https://api.weibo.com/oauth2/default.html'
        # step 2 : get authorize url and code
        client = sinaweibo.sinaweibopy3.APIClient(app_key=APP_KEY, app_secret=APP_SECRET, redirect_uri=REDIRECT_URL)
        url = client.get_authorize_url()
        # print(url)
        webbrowser.open_new(url)
        # step 3 : get Access Token
        # Copy the above address to the browser to run, 
        #enter the account and password to authorize, the new URL contains code
        result = client.request_access_token(
            input("please input code : "))  # Enter the CODE obtained in the authorized address
        print(result)
        # At this point, the access_token and expires_in should be saved,
        # because there is a validity period.A
        # If you need to send the microblog multiple times in a short time,
        # you can use it repeatedly without having to acquire it every time.
        client.set_access_token(result.access_token, result.expires_in)

        # step 4 : using api by access_token
        #print(client.public_timeline())  # get the latest public Weibo
        # =============================================================================
        #         statuses = client.public_timeline()['statuses']
        #         length = len(statuses)
        #         for i in range(0,length):
        #             print("昵称:"+statuses[i]['user']['screen_name'])
        #             print("简介:"+statuses[i]['user']['description'])
        #             print("位置:"+statuses[i]['user']['location'])
        # =============================================================================
        '''
        in this step,the api name have to turn '/' in to '__'
        for example,statuses/public_timeline(this is a standard api name) have to turn into statuses__public_timeline
        '''
        # Or use this method
        #print(client.get.statuses__public_timeline())
        print(client.get.statuses__user_timeline())
        # Obtain the UID of the authorized user
        #print(client.get.account__get_uid())

        # 发表图文微博的接口
        url_post_pic = "https://api.weibo.com/2/statuses/share.json"
        # 构建文本类POST参数
        playload = {
            "access_token": result.access_token,
            "status": "这是一条测试微博 http://www.mob.com/downloads/"
        }
        # 构建二进制multipart/form-data编码的参数
        files = {
            "pic": open("/Users/didi/Documents/PycharmProjects/article/test.jpg", "rb")
        }
        # POST请求,发表微博
        requests.post(url_post_pic, data=playload, files=files)
        # client.statuses_share()

    except ValueError:
        print('pyOauth2Error')
示例#41
0
                price = price_two
                price_two = soup.find(id="priceblock_ourprice")
            return price
        elif 'flipkart' in URL:
            price = soup.find(class_='_1vC4OE _3qQ9m1')
            return price
    except:
        return


i = 1
URL = input(" Enter the url:: ")
while True:
    price = find_price(URL)
    if price == None:
        print("Invalid link")
        break
    else:
        if (i < 2):
            current_price = price.get_text()
        previous_price = current_price

        print(f"Your current price is :: {price.get_text()}")

        if i > 2:
            current_price = price.get_text()
            if current_price != previous_price:
                webbrowser.open_new(URL)

        time.sleep(10)
 def callback(url):
     webbrowser.open_new(url)
示例#43
0
def openURL(url):
    import webbrowser
    webbrowser.open_new(url)
    return True
 def show_trailer(self):
     webbrowser.open_new_tab(self.trailer_youtube_url)
     webbrowser.open_new(self.trailer_youtube_url)       
示例#45
0
文件: editor.py 项目: edgarJ91/tytus
def generarReporteSintactico():
    ver_sintacticos()
    paths = str(os.getcwd())
    nuevapath = paths + '\\sintaticos.pdf'
    wb.open_new(nuevapath)
    print('generar Reporte')
示例#46
0
def newwindow(url):
    try:
        webbrowser.open_new(url)
    except webbrowser.Error:
        raise RuntimeError('An Error Has Occured: Unable To Open URL (0017)')
示例#47
0
文件: editor.py 项目: edgarJ91/tytus
def generarReporte():
    paths = str(os.getcwd())
    nuevapath = paths + '\\ts.gv.pdf'
    wb.open_new(nuevapath)
    print('generar Reporte')
示例#48
0
 def __authenticate(self, access_url):
     open_new(access_url)
示例#49
0
文件: editor.py 项目: edgarJ91/tytus
def graficar():
    #enviar a llamar las funciones para genera la graficar
    print('graficar')
    paths = str(os.getcwd())
    nuevapath = paths + '\\graficaArbol.png'
    wb.open_new(nuevapath)
示例#50
0
文件: editor.py 项目: edgarJ91/tytus
def generarReporteLexico():
    ver_lexicos()
    paths = str(os.getcwd())
    nuevapath = paths + '\\lexicos.pdf'
    wb.open_new(nuevapath)
    print('generar Reporte')
示例#51
0
def url():
    webbrowser.open_new("https://github.com/Yiyiyimu/QQ_History_Backup")
示例#52
0
文件: editor.py 项目: edgarJ91/tytus
def generarbnf():
    print('generar bnf')
    paths = str(os.getcwd())
    nuevapath = paths + '\\graficaGramatical.png'
    wb.open_new(nuevapath)
示例#53
0
def AbrirTablaSimbolos():
    wb.open_new(r'reporteTabla.gv.pdf')
示例#54
0
def run_render(create_viewer_func, args=RenderArgs()):
    keypoints = load_script(args.script)
    num_prefetch_frames = args.prefetch_frames
    for keypoint in keypoints:
        keypoint['state'].gpu_memory_limit = args.gpu_memory_limit
        keypoint['state'].system_memory_limit = args.system_memory_limit
        keypoint['state'].concurrent_downloads = args.concurrent_downloads
        keypoint[
            'state'].cross_section_background_color = args.cross_section_background_color
    viewers = [create_viewer_func() for _ in range(args.shards)]
    for viewer in viewers:
        with viewer.config_state.txn() as s:
            s.show_ui_controls = False
            s.show_panel_borders = False
            s.viewer_size = [args.width, args.height]
            s.scale_bar_options.scale_factor = args.scale_bar_scale

        print('Open the specified URL to begin rendering')
        print(viewer)
        if args.browser:
            webbrowser.open_new(viewer.get_viewer_url())
    lock = threading.Lock()
    num_frames_written = [0]
    fps = args.fps
    total_frames = sum(
        max(1, k['transition_duration'] * fps) for k in keypoints[:-1])

    def render_func(viewer, start_frame, end_frame):
        with lock:
            saver = neuroglancer.ScreenshotSaver(viewer, args.output_directory)
        states_to_capture = []
        frame_number = 0
        for i in range(len(keypoints) - 1):
            a = keypoints[i]['state']
            b = keypoints[i + 1]['state']
            duration = keypoints[i]['transition_duration']
            num_frames = max(1, int(duration * fps))
            for frame_i in range(num_frames):
                t = frame_i / num_frames
                if frame_number >= end_frame:
                    return

                if frame_number < start_frame:
                    frame_number += 1
                    continue

                path = saver.get_path(frame_number)

                if args.resume and os.path.exists(path):
                    frame_number += 1
                    with lock:
                        num_frames_written[0] += 1
                else:
                    cur_state = neuroglancer.ViewerState.interpolate(a, b, t)
                    states_to_capture.append((frame_number, i + t, cur_state))
                    frame_number += 1
        for frame_number, t, cur_state in states_to_capture:
            prefetch_states = [
                x[2] for x in states_to_capture[frame_number + 1:frame_number +
                                                1 + num_prefetch_frames]
            ]
            prev_state = viewer.state.to_json()
            cur_state = cur_state.to_json()
            cur_state['layers'] = prev_state['layers']
            cur_state = neuroglancer.ViewerState(cur_state)
            viewer.set_state(cur_state)
            if num_prefetch_frames > 0:
                with viewer.config_state.txn() as s:
                    del s.prefetch[:]
                    for i, state in enumerate(prefetch_states[1:]):
                        s.prefetch.append(
                            neuroglancer.PrefetchState(
                                state=state, priority=num_prefetch_frames - i))
            frame_number, path = saver.capture(frame_number)
            with lock:
                num_frames_written[0] += 1
                cur_num_frames_written = num_frames_written[0]
                print('[%07d/%07d] keypoint %.3f/%5d: %s' %
                      (cur_num_frames_written, total_frames, t, len(keypoints),
                       path))

    shard_frames = []
    frames_per_shard = int(math.ceil(total_frames / args.shards))
    for shard in range(args.shards):
        start_frame = frames_per_shard * shard
        end_frame = min(total_frames, start_frame + frames_per_shard)
        shard_frames.append((start_frame, end_frame))
    render_threads = [
        threading.Thread(target=render_func,
                         args=(viewer, start_frame, end_frame))
        for viewer, (start_frame, end_frame) in zip(viewers, shard_frames)
    ]
    for t in render_threads:
        t.start()
    for t in render_threads:
        t.join()
示例#55
0
def AbrirBNF():
    wb.open_new(r'reporteBNF.gv.pdf')
示例#56
0
 def op_link(self, event):
     webbrowser.open_new(self.n[2])
        except sr.RequestError as e:
            print("No hemos podido conectar con el servicio de Google; {0}".
                  format(e))

    # Wheater
    if "time" in r.recognize_google(audio):
        r1 = sr.Recognizer()
        url1 = 'https://www.eltiempo.es/'
        with sr.Microphone() as source:
            print('¿De que ciudad? ')
            audio1 = r1.listen(source)

            try:
                print("Google Speech recognition thinks you said " +
                      r1.recognize_google(audio) +
                      webbrowser.open_new(url1 + r1.recognize_google(audio1)))
            except sr.UnknownValueError:
                print("Google Speech Recognition could not understand audio.")
            except sr.RequestError as e:
                print(
                    "Could not request results from Google Speech Recognition."
                )

    # Youtube
    if "video" in r.recognize_google(audio):
        r2 = sr.Recognizer()
        url2 = 'https://youtube.com/results?search_query='
        with sr.Microphone() as source:
            print("Dime que quieres ver ")
            audio2 = r2.listen(source)
示例#58
0
def AbrirErrores():
    wb.open_new(r'reporteErrores.gv.pdf')
示例#59
0
 def cmd_cricket_docs(self):
     "Show the Cricket documentation"
     webbrowser.open_new('https://cricket.readthedocs.io/')
示例#60
0
def AbrirAST():
    wb.open_new(r'tree.gv.pdf')