ignore missing atmo api token settings

This commit is contained in:
Frédéric Péters 2022-09-11 11:52:37 +02:00
parent 3a466d7a98
commit bc55309eb1
1 changed files with 6 additions and 5 deletions

View File

@ -59,6 +59,8 @@ class Command(BaseCommand):
COMBO_MAP_ATTRIBUTION = "&copy; <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>"
COMBO_GEOCODING_SERVICE = 'https://nominatim.entrouvert.org'
atmo_api_token = getattr(settings, 'ATMO_API_TOKEN', '')
JSON_CELL_TYPES = self.settings_json.get('JSON_CELL_TYPES.update') or {}
JSON_CELL_TYPES = {
"velov": {
@ -171,7 +173,7 @@ class Command(BaseCommand):
},
"airquality": {
"url": "{% if q_lat or lat %}https://api.atmo-aura.fr/partenaires/v2/indice_request?longitude={% firstof q_lon lon %}&latitude={% firstof q_lat lat %}&"
+ settings.ATMO_API_TOKEN
+ atmo_api_token
+ "{% endif %}",
"cache_duration": 300,
"force_async": False,
@ -201,18 +203,17 @@ class Command(BaseCommand):
"{% now \"Y-m-d\" as today %}"
"{% with today|add_days:\"-1\"|date:\"Y-m-d\" as yesterday %}"
"https://api.atmo-aura.fr/api/v1/communes/69123/indices/atmo?date_debut_echeance={{yesterday}}"
"{% endwith %}{% endif %}&" + settings.ATMO_API_TOKEN,
"{% endwith %}{% endif %}&" + atmo_api_token,
},
{
"key": "definitions",
"url": "https://api.atmo-aura.fr/api/v1/indices/atmo/definitions?"
+ settings.ATMO_API_TOKEN,
"url": "https://api.atmo-aura.fr/api/v1/indices/atmo/definitions?" + atmo_api_token,
"cache_duration": 86400,
},
{
"key": "vigilances",
"url": "https://api.atmo-aura.fr/api/v1/communes/69123/vigilances?date=now&"
+ settings.ATMO_API_TOKEN,
+ atmo_api_token,
"cache_duration": 300,
},
{