pwaqi/__init__.py
def findStationCodesByCity(city_name, token):
    """Lookup AQI database for station codes in a given city."""
    req = requests.get(
        API_ENDPOINT_SEARCH,
        params={
            'token': token,
            'keyword': city_name
        })

    if req.status_code == 200 and req.json()["status"] == "ok":
        return [result["uid"] for result in req.json()["data"]]
    else:
        return []
def findStationCodesByCity(city_name, token):
    req = requests.get(
        API_ENDPOINT_SEARCH,
        params={
            'token': token,
            'keyword': city_name
        })

    if req.status_code == 200 and req.json()["status"] == "ok":
        return [result["uid"] for result in req.json()["data"]]
    else:
        return []
def findStationCodesByCity ( city_name , token ) : req = requests . get ( API_ENDPOINT_SEARCH , params = { 'token' : token , 'keyword' : city_name } ) if req . status_code == 200 and req . json ( ) [ "status" ] == "ok" : return [ result [ "uid" ] for result in req . json ( ) [ "data" ] ] else : return [ ]
Lookup AQI database for station codes in a given city.
Lookup AQI database for station codes in a given city .