def get_connected(authentication): configpath = os.path.join(os.getcwd(), 'voomon.ini') dataurl = myconfig.get_value(configpath, 'CONNECTIONS_DATA', 'COMPUTERS_URL') script_position = int(myconfig.get_value(configpath, 'CONNECTIONS_DATA', 'SCRIPT_POSITION')) con_regex = r"(\b(?:\d{1,3}\.){3}\d{1,3}\|[a-zA-Z0-9-]*\|\b(?:[a-f0-9]{2}\:){5}[a-f0-9]{2}\b)" response = url.get_url(dataurl, authentication) if not response: mylogger.error("[-] Response error.") pass soup = BeautifulSoup(response) script = soup.findAll("script")[script_position].contents[0].replace('\n', '') if not script: mylogger.error("[-] Script not found.") pass con_list = re.findall(con_regex, script) # TODO: Remove unwanted from the list for con in con_list: print(con.split('|'))
def make_matchid_json(self): is_first = True next_id = -1 while (True): has_next = False result = {} _url = self._make_steam_url(next_id) result = url.get_url(_url) sort_matches = self._sort_matches_api(result) self._add_match(sort_matches) if not self._has_next(sort_matches): break next_id = sort_matches[-1]['match_id']
def _make_details(self): for matchid in self._steamjson.get_matches().keys(): _url = self._make_url(matchid) result = url.get_url(_url) self._add_detail(result)
list_of_types = [] for x in range(location_types): types = input("Location Type: STEPS, TOTALTIME, TOTALDISTANCE, ELEVATION, LATLONG: ") #Enter the location type: DIRECTIONS, STEPS, TOTALDISTANCE, TOTALTIME, ELEVATION list_of_types.append(types) return list_of_places, list_of_types break if __name__ == '__main__': '''main''' list1,list2 =user_input() result = url.get_url(url.build_search_url(list1)) elevation_url = url.build_elevation_url(result) elevationjson = url.get_elevation_url(elevation_url) for entered in list2: if entered == 'STEPS': print() print('DIRECTIONS') steps = types_classes.directions() steps = steps.stuff(result) print()
print("Corrigir") #f = open(path + "/report.txt", 'a') #f.write("W: "+ str(wait).zfill(2) + " " + str(time_id) + " S: " + '{:04f}'.format(score) + " V: " + '{:04f}'.format(sound) + "\n") #f.close() if wait > 0: wait -= 1 command_delay = (command_delay + 1) % loop if command_delay == 0: try: command = get_url() if command == "reboot" or command == "Reboot": os.system("reboot") elif command == "shutdown" or command == "Shutdown": os.system("shutdown now") elif command == "enable" or command == "Enable": pic_enabled = True elif command == "disable" or command == "Disable": pic_enabled = False except: pass time_end = time() print('{:04f}'.format(time_end - time_taken), "Sec", "Cmd:", command, "-", str(command_delay).zfill(2), "Time:", time_id, "W:", str(wait).zfill(3))
def get(args): res = requests.get(*get_url(args)) if not res.ok: return dumps("Server error:{0}".format( Exception(res.reason, res.status_code))) return res
def test_get_url_no_param(self): arguments = {'--help': False, '--page': None, '<ticket>': None, 'show': True} self.assertEqual(get_url(arguments), ("http://127.0.0.1:3000/tickets",))