Skip to content

boeingpete/AVWX-API

 
 

Repository files navigation

AVWX-API

Requirements Status License: MIT

About

The AVWX REST API is built as a Python Quart app which is a Flask-compatible async web backend. It sources METAR and TAF reports from NOAA ADDS and other localized weather sources (where available) via the AVWX-Engine library which I also maintain.

The core benefit of AVWX over other sources is its parsing engine. It provides a more accurate interpretation of the raw report string than aging government sources and includes value-added features like calculating flight-rules, translating report elements into English, and providing text-to-speech representations of the report and its elements.

For more information, go to the hosted version at avwx.rest.

Quickstart

The easiest way to get the app running is to create and run it in Docker. First, copy to example Dockerfile.

cp Dockerfile.example Dockerfile

Now we need to comment out three ENV vars in the Dockerfile. These are grouped together:

ENV MONGO_URI='...'
ENV PSQL_URI='...'
ENV GN_USER='...'

A quick explanation of what these do:

  • MONGO_URI: This connects the app to the request caching database. Commenting out disables caching
  • PSQL_URI: This connects the app to the account database for things like token authentication. Commenting out opens all endpoints
  • GN_USER: This is the GeoNames user name for coordinate lookup calls. Commenting out causes coord requests to fail. You can supply your own for testing

Now you should be able to build and run the Docker container:

docker build -t avwx_api .
docker run -p 8000:8000 avwx_api

It should now be available at http://localhost:8000

Setup

First we should install the app requirements and copy the env file. I recommend always installing into a virtual environment. Dotenv is not in the requirements file because it is only used in development.

pip install -r requirements.txt
pip install python-dotenv
cp .env.sample .env

For an explaination of the variables in .env, see the quickstart. Feel free to comment or replace these as you see fit.

Before we can run the app, we need to tell Quart where the app is.

export QUART_APP=avwx_api:app
export QUART_ENV=development

Running

Once the app is configured, use the Quart CLI to run it. It will be in development/debug mode.

quart run -p 8000

It should now be available at http://localhost:8000

Develop

Code checked into this repository is expected to be run through the black code formatter first.

# Install black
pip install black

# Format py package files
find avwx_api -iname "*.py" | xargs black

About

REST API for parsing aviation weather data

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • API Blueprint 55.4%
  • Python 32.3%
  • HTML 10.8%
  • Other 1.5%