Skip to content

Instantly share code, notes, and snippets.

@sheep7
sheep7 / artfakta_speciesdata.py
Created September 28, 2025 12:17
Artdatabanken Artfakta Species information API client
# Artdatabanken Artfakta Species information API client
#
# Supports searching taxon information by taxon id, common name or scientific name.
# Expects a `.adb_api_key` file in the same directory that contains an API key.
#
# Usage examples:
# >>> from artfakta_speciesdata import Taxon
# >>> taxon = Taxon.get_by_cn("stubbspretmossa")
# >>> taxon.status
# 'S'
@sheep7
sheep7 / securesettings.py
Created October 20, 2024 19:35
store secrets in a secure settings file protected by a user-supplied main password
import pathlib
import cryptography.exceptions
import cryptography.fernet
import cryptography.hazmat.backends
import cryptography.hazmat.primitives.hashes
import cryptography.hazmat.primitives.kdf.pbkdf2
import base64
import getpass
import json
import secrets