API interface for storing and accessing historical weather data
GET /weather-data
: Retrieve weather data based on various optional parameters like date, weather type, and data limit.
POST /weather-data/csv
: Upload a CSV file to add bulk weather data. Only CSV files with valid headers are accepted.
- Download the project
git clone https://github.com/Tiffany8/txg.git
- Make the script executable
chmod +x run_service_and_e2e.sh
-
Run the script:
./run_service_and_e2e.sh
To include end-to-end tests, use the
--e2e
flag:./run_service_and_e2e.sh --e2e
Once the service is running, you can also navigate to localhost:8000/docs in your web browser to explore the API and understand the parameters via the OpenAPI interface.
I like to use httpie
to populate your database:
http -f POST localhost:8000/weather-data/csv file@/PATH/to/data/seattle-weather-10k.csv
to get:
data from March 9, 2012:
http localhost:8000/weather-data date==2012-03-09
rain data:
http localhost:8000/weather-data weather==rain