mirror of
				https://github.com/craigerl/aprsd.git
				synced 2025-11-03 13:10:31 -05:00 
			
		
		
		
	Added new config for aprs.fi API Key
This patch adds the new required aprs.fi api key. This key is used by 2 of the core plugins, locationPlugin and weatherPlugin. You must set the apiKey in the config, or aprsd won't start.
This commit is contained in:
		
							parent
							
								
									3dd23fa2ad
								
							
						
					
					
						commit
						bdeaf6348a
					
				@ -21,6 +21,7 @@ class LocationPlugin(plugin.APRSDPluginBase):
 | 
			
		||||
    def command(self, fromcall, message, ack):
 | 
			
		||||
        LOG.info("Location Plugin")
 | 
			
		||||
        # get last location of a callsign, get descriptive name from weather service
 | 
			
		||||
        api_key = self.config["aprs.fi"]["apiKey"]
 | 
			
		||||
        try:
 | 
			
		||||
            # optional second argument is a callsign to search
 | 
			
		||||
            a = re.search(r"^.*\s+(.*)", message)
 | 
			
		||||
@ -33,7 +34,7 @@ class LocationPlugin(plugin.APRSDPluginBase):
 | 
			
		||||
            url = (
 | 
			
		||||
                "http://api.aprs.fi/api/get?name="
 | 
			
		||||
                + searchcall
 | 
			
		||||
                + "&what=loc&apikey=104070.f9lE8qg34L8MZF&format=json"
 | 
			
		||||
                + "&what=loc&apikey={}&format=json".format(api_key)
 | 
			
		||||
            )
 | 
			
		||||
            response = requests.get(url)
 | 
			
		||||
            # aprs_data = json.loads(response.read())
 | 
			
		||||
 | 
			
		||||
@ -16,11 +16,12 @@ class WeatherPlugin(plugin.APRSDPluginBase):
 | 
			
		||||
 | 
			
		||||
    def command(self, fromcall, message, ack):
 | 
			
		||||
        LOG.info("Weather Plugin")
 | 
			
		||||
        api_key = self.config["aprs.fi"]["apiKey"]
 | 
			
		||||
        try:
 | 
			
		||||
            url = (
 | 
			
		||||
                "http://api.aprs.fi/api/get?"
 | 
			
		||||
                "&what=loc&apikey=104070.f9lE8qg34L8MZF&format=json"
 | 
			
		||||
                "&name=%s" % fromcall
 | 
			
		||||
                "&what=loc&apikey={}&format=json"
 | 
			
		||||
                "&name={}".format(api_key, fromcall)
 | 
			
		||||
            )
 | 
			
		||||
            response = requests.get(url)
 | 
			
		||||
            # aprs_data = json.loads(response.read())
 | 
			
		||||
 | 
			
		||||
@ -21,6 +21,7 @@ DEFAULT_CONFIG_DICT = {
 | 
			
		||||
        "port": 14580,
 | 
			
		||||
        "logfile": "/tmp/arsd.log",
 | 
			
		||||
    },
 | 
			
		||||
    "aprs.fi": {"apiKey": "set me"},
 | 
			
		||||
    "shortcuts": {
 | 
			
		||||
        "aa": "5551239999@vtext.com",
 | 
			
		||||
        "cl": "craiglamparter@somedomain.org",
 | 
			
		||||
@ -172,6 +173,12 @@ def parse_config(config_file):
 | 
			
		||||
        "callsign",
 | 
			
		||||
        default_fail=DEFAULT_CONFIG_DICT["ham"]["callsign"],
 | 
			
		||||
    )
 | 
			
		||||
    check_option(
 | 
			
		||||
        config,
 | 
			
		||||
        "aprs.fi",
 | 
			
		||||
        "apiKey",
 | 
			
		||||
        default_fail=DEFAULT_CONFIG_DICT["aprs.fi"]["apiKey"],
 | 
			
		||||
    )
 | 
			
		||||
    check_option(config, "aprs", "login")
 | 
			
		||||
    check_option(config, "aprs", "password")
 | 
			
		||||
    # check_option(config, "aprs", "host")
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user