Тренувальний Міні-контест на УКХРегламент контестаСтатистика контеста
0 Користувачів і 9 Гостей дивляться цю тему.
def aprs_request(callsign): aprs_apikey="apikey" apiurl = "https://api.aprs.fi/api/get?name="+ str(callsign) + "&what=loc&apikey=" + str(aprs_apikey) + "&format=json" apireq = requests.get(apiurl) apidata = json.loads(apireq.text) print("-"*10 + "> | APRS data" ) if not apidata['entries']: print("Warning: No APRS data found") else: for i in apidata['entries']: print("| APRS Name: " + str(i['name']) + "\n" + "| APRS Lat: " + str(i['lat']) + "\n" + "| APRS Lng: " + str(i['lng']) + "\n" + "| Lasttime seen: " + datetime.utcfromtimestamp(int(i['lasttime'])).strftime('%Y-%m-%d %H:%M:%S') + "\n" + "| Comment: " + str(i['comment'])) time.sleep(15)
===============| UR0UUA |===================================----------> | APRS data| APRS Name: UR0UUA| APRS Lat: 50.42333| APRS Lng: 30.46367| Lasttime seen: 2021-03-26 17:27:39| Comment: 439.375MHz -760 T067 R99===============| UR0UUB |===================================----------> | APRS data| APRS Name: UR0UUB| APRS Lat: 50.391| APRS Lng: 30.4805| Lasttime seen: 2021-03-26 17:23:34| Comment: 439.400MHz-760 DMR CC1 R100===============| UR0UUD |===================================----------> | APRS data| APRS Name: UR0UUD| APRS Lat: 50.44533| APRS Lng: 30.5045| Lasttime seen: 2021-03-26 17:24:50| Comment: 438.700MHz D023 -7.60 http://cb.org.ua===============| UR0UUE |===================================----------> | APRS data| APRS Name: UR0UUE| APRS Lat: 50.44517| APRS Lng: 30.50533| Lasttime seen: 2021-03-26 17:25:51| Comment: 438.775MHz -7.60 DMR CC1 http://cb.org.ua
apiurl = "https://api.aprs.fi/api/get?name="+ str(callsign) + "&what=loc&apikey=" + str(aprs_apikey) + "&format=json"
#!/bin/python3import re, requests, sys, string,json,time,datetimeimport configparserfrom datetime import datetime # for convert APRS timeletters = list(string.ascii_uppercase)digits = list(string.digits)config = configparser.ConfigParser()config.read('config.ini')dict_callsigns = {'Крим':'J', 'Вінницька':'N', 'Волинська':'P', 'Дніпропетровська':'E', 'Житомирська':'X','Закарпатська':'D', 'Запорізька':'Q','Івано - Франківська':'S', 'Київ':'U','Кіровоградська':'V','Львівська':'W', 'Миколаївська':'Z','Одеська':'F', 'Полтавська':'H','Рівненська':'K','Сумська':'A','Тернопільська':'B','Харківська':'L', 'Херсонська':'G','Хмельницька':'T','Черкаська':'C','Чернівецька':'Y','Чернігівська':'R'}def repeaters_2m_callsign_generator(region): list = [] for third_letter in dict_callsigns[region]: for four_letter in letters[21:22]: for five_letter in letters: list.append(str("UR0" + third_letter + four_letter + five_letter)) return listdef repeaters_70cm_callsign_generator(region): list = [] for third_letter in dict_callsigns[region]: for four_letter in letters[20:21]: for five_letter in letters: list.append(str("UR0" + third_letter + four_letter + five_letter)) return listdef aprs_request(callsign): aprs_apikey=config['APRS']['token'] apiurl = "https://api.aprs.fi/api/get?name="+ str(callsign) + "&what=loc&apikey=" + str(aprs_apikey) + "&format=json" apireq = requests.get(apiurl) apidata = json.loads(apireq.text) print("-"*10 + "> | APRS data" ) if not apidata['entries']: print("Warning: No APRS data found") time.sleep(15) else: for i in apidata['entries']: print("| APRS Name: " + str(i['name']) + "\n" + "| APRS Lat: " + str(i['lat']) + "\n" + "| APRS Lng: " + str(i['lng']) + "\n" + "| Lasttime seen: " + datetime.utcfromtimestamp(int(i['lasttime'])).strftime('%Y-%m-%d %H:%M:%S') + "\n" + "| Comment: " + str(i['comment'])) time.sleep(15)if __name__ == '__main__': print("APRS 70cm repeaters data") for callsign in repeaters_70cm_callsign_generator("Київ"): aprs_request(callsign) for callsign in repeaters_2m_callsign_generator("Київ"): aprs_request(callsign)
[APRS]token = validAPRStokenhere
APRS 70cm repeaters data----------> | UR0UUA APRS data| APRS Name: UR0UUA| APRS Lat: 50.42333| APRS Lng: 30.46367| Lasttime seen: 2021-03-31 14:54:25| Comment: 439.375MHz -760 T067 R99----------> | UR0UUB APRS data| APRS Name: UR0UUB| APRS Lat: 50.391| APRS Lng: 30.4805| Lasttime seen: 2021-03-31 14:45:20| Comment: 439.400MHz-760 DMR CC1 R100----------> | UR0UUC APRS dataWarning: No APRS data found----------> | UR0UUD APRS data| APRS Name: UR0UUD| APRS Lat: 50.44533| APRS Lng: 30.5045| Lasttime seen: 2021-03-31 14:44:51| Comment: 438.700MHz D023 -7.60 http://cb.org.ua----------> | UR0UUE APRS data| APRS Name: UR0UUE| APRS Lat: 50.44517| APRS Lng: 30.50533| Lasttime seen: 2021-03-31 14:45:51| Comment: 438.775MHz -7.60 DMR CC1 http://cb.org.ua----------> | UR0UUF APRS dataWarning: No APRS data found----------> | UR0UUG APRS dataWarning: No APRS data found----------> | UR0UUH APRS dataWarning: No APRS data found----------> | UR0UUI APRS dataWarning: No APRS data found----------> | UR0UUJ APRS dataWarning: No APRS data found----------> | UR0UUK APRS data| APRS Name: UR0UUK| APRS Lat: 50.52733| APRS Lng: 30.2285| Lasttime seen: 2021-03-31 14:54:35| Comment: 438.825MHz -760 DMR CC1 R77----------> | UR0UUL APRS data| APRS Name: UR0UUL| APRS Lat: 50.53417| APRS Lng: 30.60467| Lasttime seen: 2021-03-31 14:43:30| Comment: 438.675MHz -760 DMR CC1 R71----------> | UR0UUM APRS dataWarning: No APRS data found----------> | UR0UUN APRS data| APRS Name: UR0UUN| APRS Lat: 50.51617| APRS Lng: 30.77967| Lasttime seen: 2021-03-31 14:46:40| Comment: 438.800MHz -760 T088 R76----------> | UR0UUO APRS dataWarning: No APRS data found----------> | UR0UUP APRS dataWarning: No APRS data found----------> | UR0UUQ APRS data| APRS Name: UR0UUQ| APRS Lat: 50.45883| APRS Lng: 30.35333| Lasttime seen: 2021-03-31 15:06:16| Comment: 439.275MHz -760 DMR CC1 R95----------> | UR0UUR APRS data| APRS Name: UR0UUR| APRS Lat: 50.55000| APRS Lng: 30.19983| Lasttime seen: 2020-04-19 10:31:26| Comment: 438.900MHz -760 DMR CC1 R80----------> | UR0UUS APRS data| APRS Name: UR0UUS| APRS Lat: 50.469| APRS Lng: 30.60317| Lasttime seen: 2021-03-31 15:05:49| Comment: 439.000MHz -760 DMR CC1----------> | UR0UUT APRS data| APRS Name: UR0UUT| APRS Lat: 50.15383| APRS Lng: 30.74617| Lasttime seen: 2021-03-31 15:03:04| Comment: 438.975MHz -760 DMR CC1 R83----------> | UR0UUU APRS data| APRS Name: UR0UUU| APRS Lat: 50.51733| APRS Lng: 30.237| Lasttime seen: 2021-03-31 15:01:33| Comment: R79 438.875(-7.600)MHz Irnen CTCSS 88.5----------> | UR0UUV APRS dataWarning: No APRS data found----------> | UR0UUW APRS dataWarning: No APRS data found----------> | UR0UUX APRS dataWarning: No APRS data found----------> | UR0UUY APRS dataWarning: No APRS data found----------> | UR0UUZ APRS dataWarning: No APRS data found