This project is to automate the process of creating the weekly Qxf2 newsletter. We take the URLs posted on the Skype channel as input and create a MailChimp campaign.
-
Clone the repository
-
Run
docker build --tag $TAG .
docker run -it -p 5000:5000 $TAG
At this point, you are ready to run the app locally.
- To test that your setup works, please visit http://localhost:5000 and login. Then, try to add a single article via the form in the /articles page.
To add articles using POST method use the following:
- Set your api key in environment variable as
'API_KEY': '<YOURAPIKEY>'
- Use the same api key for Request headers
'x-api-key': '<YOURAPIKEY>'
- API Endpoint: POST
<base_url>/api/articles
- Example curl command
curl -X POST http://localhost:5000/api/articles -H 'X-API-KEY: <YOUR_API_KEY>' -F 'url=http://exampleURL.com' -F 'category_id=2
Great Expectations is an open-source Python library to test data pipelines. It helps in validating and documenting data and thus maintaining data quality.
-
Install great_expectations:
pip install great_expectations
-
Set the environment variables prefixed with
DB_
, mentioned in great_expectations.yml -
Navigate to tests > data_validation > great_expectations directory:
cd tests/data_validation/great_expectations
-
Run the checkpoint script. Navigate to newsletter_automation directory and run:
pytest tests/data_validation/great_expectations/utils/ -s -v -m checkpoint10am
This will trigger the Checkpoint and run the Expectation Suite against the MySQL table data as configured in the datasource. Please use the correct pytest marker to trigger the relevant checkpoint.
-
Results are stored in
great_expectations/uncommitted/data_docs/local_site
folder. Navigate to the above directory using File Explorer. Open index.html, go to Validations tab and select your recent run. It will show details of what expectations have run, how many have passed/failed, failure details etc.