try: sentMessages = browser.find_element_by_link_text('Total Messages Sent') sentMessages.click() except: print 'Not able to do this' quit() # change the date range of sent messages # open from date calendar and specify the from date try: fpopCal = browser.find_element_by_text('body:viewReportSentCampaign:viewReportData:fromDatePopupButton') fpopCal.click() except: print 'Could not open "FROM" calendar' webbrowser.close() quit() # specify the from date try: fromDate = browser.find_element_by_name(fday) fromDate.click() except: print 'Could not validate "FROM" date' webbrowser.close() quit() # To date is defaulted to today's date # once dates are changed, auto submit
def correct(project, sample, code): import webbrowser #update check_peak.ini webbrowser.open('check_peak.ini') #run check_peak.py webbrowser.close() #run image again at same position return
def close_web(self, social_provider): print "closing web" self.wfile.write( "You have successfully logged in to {}. ".format(social_provider)+\ "You can close this window.") import webbrowser if hasattr(webbrowser, 'close'): webbrowser.close() AuthHandler.stop_serving = True
def main(): import time import webbrowser break_count = 0 total_breaks = 3 print "This program started on "+ time.ctime() while (break_count < total_breaks): time.sleep(5) webbrowser.close("https://www.youtube.com/watch?v=t03wigE8GK0") break_count += 1
def about(): layoutabout = [[sg.Text("This app made by NumeX#1790")], [ sg.Button("Link App"), sg.Button("Youtube"), sg.Button("Discord") ], [sg.Button("Close")]] windowabout = sg.Window("About", layoutabout) eventa, valuesa = windowabout.read() if eventa == "Link App": webbrowser.open("https://github.com/NumeXx/GTPS-Launcher-IP") windowabout.close() elif eventa == "Youtube": webbrowser.open( 'https://www.youtube.com/channel/UCDXi6rK5MBvpQ-o4Gn5pJhg') windowabout.close() elif eventa == "Discord": webbrowser.open("https://discord.gg/HDuBhZmTBA") webbrowser.close() elif eventa == "Close": windowabout.close()
#!/usr/bin/env python #-*- coding:UTF-8 -*- import webbrowser import time url1 = 'http://www.youku.com' url2 = 'http://actives.youku.com/task/signv2/index' #webbrowser.open(url1,new = 0,autoraise = True) webbrowser.open(url2, new=0, autoraise=True) webbrowser.get() print "Successed" time.sleep(5) webbrowser.close(webbrowser.get())
def apologise(): webbrowser.open("https://youtu.be/ZSM3w1v-A_Y") time.sleep(188) webbrowser.close() apologise()
def get_access_code(client_id=CLIENT_ID, redirect_uri=REDIRECT_URI, oauth_url=OAUTH_URL): # zmienna auth_url zawierać będzie zbudowany na podstawie podanych parametrów URL do zdobycia kodu auth_url = '{}/authorize' \ '?response_type=code' \ '&client_id={}' \ '&redirect_uri={}'.format(oauth_url, client_id, redirect_uri) # uzywamy narzędzia z modułu requests - urlparse - służy do sparsowania podanego url # (oddzieli hostname od portu) parsed_redirect_uri = requests.utils.urlparse(redirect_uri) # definiujemy nasz serwer - który obsłuży odpowiedź allegro (redirect_uri) server_address = parsed_redirect_uri.hostname, parsed_redirect_uri.port # Ta klasa pomoże obsłużyć zdarzenie GET na naszym lokalnym serwerze # - odbierze żądanie (odpowiedź) z serwisu allegro class AllegroAuthHandler(BaseHTTPRequestHandler): def __init__(self, request, address, server): super().__init__(request, address, server) def do_GET(self): self.send_response(200, 'OK') self.send_header('Content-Type', 'text/html') self.end_headers() self.server.path = self.path self.server.access_code = self.path.rsplit('?code=', 1)[-1] # Wyświetli nam adres uruchomionego lokalnego serwera print('server_address:', server_address) # Uruchamiamy przeglądarkę, przechodząc na adres zdefiniowany do uzyskania kodu dostępu # wyświetlić się powinien formularz logowania do serwisu Allegro.pl webbrowser.open(auth_url) # Uruchamiamy nasz lokalny web server na maszynie na której uruchomiony zostanie skrypt # taki serwer dostępny będzie pod adresem http://localhost:8000 (server_address) httpd = HTTPServer(server_address, AllegroAuthHandler) print( 'Waiting for response with access_code from Allegro.pl (user authorization in progress)...' ) # Oczekujemy tylko jednego żądania httpd.handle_request() # Po jego otrzymaniu zamykamy nasz serwer (nie obsługujemy już żadnych żądań) httpd.server_close() # Klasa HTTPServer przechowuje teraz nasz access_code - wyciągamy go _access_code = httpd.access_code # Dla jasności co się dzieje - można wyświetlić access_code w konsoli # print('Got an authorize code: ', _access_code) # # no i zapisujemy do pliku... kod10sek = open("./cache/allsi_kod-autoryzujacy-10sekund", "w") kod10sek.write(_access_code) kod10sek.close() # rezultat działania funkcji return _access_code webbrowser.close(auth_url)
#!/usr/bin/env python #-*- coding:UTF-8 -*- import webbrowser import time url1 = 'http://www.youku.com' url2 = 'http://actives.youku.com/task/signv2/index' #webbrowser.open(url1,new = 0,autoraise = True) webbrowser.open(url2,new = 0,autoraise = True) webbrowser.get() print "Successed" time.sleep(5) webbrowser.close(webbrowser.get())
wishMe() while True: query = takeCommand().lower() if 'wikipedia' in query: speak("Searching Wikipedia .... please wait ...") query = query.replace("wikipedia", "") result = wikipedia.summary(query, sentences=3) speak("According to wikipedia") print(f"\n Result is :{result}") speak(result) elif 'open youtube' in query: webbrowser.open("youtube.com") elif 'close youtube ' in query: webbrowser.close("youtube.com") elif 'hello jarvis' in query: speak("Hello Sir") elif 'play music' in query: music_dir = 'E:\\Music' songs = os.listdir(music_dir) print(songs) os.startfile(os.path.join(music_dir, songs[random])) elif 'the time' in query: strTime = datetime.datetime.now().strftime("%H:%M:%S") speak(f"Sir, The time is {strTime}") elif 'open code' in query:
sentMessages = browser.find_element_by_link_text('Total Messages Sent') sentMessages.click() except: print 'Not able to do this' quit() # change the date range of sent messages # open from date calendar and specify the from date try: fpopCal = browser.find_element_by_text( 'body:viewReportSentCampaign:viewReportData:fromDatePopupButton') fpopCal.click() except: print 'Could not open "FROM" calendar' webbrowser.close() quit() # specify the from date try: fromDate = browser.find_element_by_name(fday) fromDate.click() except: print 'Could not validate "FROM" date' webbrowser.close() quit() # To date is defaulted to today's date # once dates are changed, auto submit
def close_facebook(): webbrowser.close("https://facebook.com")
def funcos5(): webbrowser.close()