how to get timestamp_measured from the api https://api.luchtmeetnet.nl in python

You can use the requests module in Python to make a GET request to the API endpoint and retrieve the data. Here's an example code that retrieves the timestamp_measured field for a specific station:

main.py
import requests

# Set the API endpoint
url = 'https://api.luchtmeetnet.nl/static/data/measurements.csv'

# Set the station ID and parameter code for the data you want to retrieve
station_id = 'NL10128'
parameter_code = 'PM25'

# Make the request to the API endpoint
response = requests.get(f'{url}?station={station_id}&parameter={parameter_code}')

# Get the response text and split it at each new line
data = response.text.split('\n')

# Get the timestamp for the most recent measurement
timestamp_measured = data[-2].split(',')[1]
print(timestamp_measured)
560 chars
19 lines

Note: Please ensure that you have the correct station ID and parameter code before making the API call.

gistlibby LogSnag