-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from okfde/develop
2023 Updates
- Loading branch information
Showing
13 changed files
with
167 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[bumpversion] | ||
current_version = 0.5.0 | ||
current_version = 2023.11.10 | ||
commit = True | ||
tag = True | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.5.0 | ||
2023.11.10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "0.5.0" | ||
__version__ = "2023.11.10" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,23 @@ def get_env(name, default=None): | |
API_TOKEN_LIFETIME = int(get_env("API_TOKEN_LIFETIME", 60 * 24)) # in minutes | ||
API_HTTPS = as_bool(get_env("API_HTTPS"), False) | ||
|
||
API_TITLE = get_env("API_TITLE", "Farmsubsidy.org API") | ||
API_CONTACT = { | ||
"name": get_env("API_CONTACT_NAME", "Farmsubsidy.org"), | ||
"url": get_env("API_CONTACT_URL", "https://farmsubsidy.org"), | ||
"email": get_env("API_CONTACT_EMAIL", "[email protected]") | ||
} | ||
API_DESCRIPTION = """ | ||
This api exposes detailed data relating to payments and recipients of farm | ||
subsidies in every EU member state based on EU's Common Agricultural Policy | ||
(CAP). | ||
The data is stored in a [clickhouse](https://clickhouse.com/) instance and feeds | ||
the public website [farmsubsidy.org](https://farmsubsidy.org) | ||
[data parsing and api repo on github](https://github.com/okfde/farmsubsidy-store) | ||
""" | ||
|
||
PUBLIC_YEARS = get_env("API_PUBLIC_YEARS", "2020,2021").split(",") | ||
EXPORT_DIRECTORY = get_env("EXPORT_DIRECTORY", os.path.join(DATA_ROOT, "exports")) | ||
EXPORT_PUBLIC_PATH = get_env("EXPORT_PUBLIC_PATH", "/exports") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "ab5ea961-0ab0-4cf5-bcb3-fc0c99af0055", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import pandas as pd\n", | ||
"import shortuuid\n", | ||
"import bcrypt" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "e9308c8d-4b57-4ca8-989d-f05fe3860ae3", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"HTPASSWD = \".htpasswd\"\n", | ||
"CLEARFILE = \"fs_logins.csv\"\n", | ||
"PREFIX = \"farmsubsidy\"" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "acd0247c-afac-4de7-916d-e1efc9f3a9d0", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"def generate_logins(start, end, prefix):\n", | ||
" for i in range(start, end):\n", | ||
" pw = shortuuid.uuid()[:12]\n", | ||
" hashed = bcrypt.hashpw(pw.encode(), bcrypt.gensalt()).decode()\n", | ||
" yield f\"{prefix}-{str(i).zfill(4)}\", hashed, pw" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "a018fa38-86b2-4397-b176-d72d039210c8", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"df = pd.DataFrame(generate_logins(0, 100, PREFIX), columns=(\"username\", \"hashed\", \"password\"))\n", | ||
"df.head()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "e64ac6f1-5148-472e-8824-0cc6644aa3b7", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"df[[\"username\", \"password\"]].to_csv(CLEARFILE, index=False)\n", | ||
"df[[\"username\", \"hashed\"]].to_csv(HTPASSWD, index=False, header=False, sep=\":\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "c49f125a-f41d-413a-8315-ad4d11d05164", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.10.9" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |