Create basic recipe stuff.

This commit is contained in:
2024-06-17 13:56:13 -04:00
parent d31d53ca9b
commit e0ac1f96db
4 changed files with 444 additions and 5 deletions

View File

@ -9,9 +9,45 @@ RECIPE_URL = 'https://api.brewfather.app/v2/recipes'
BATCH_URL = 'https://api.brewfather.app/v2/batches'
PULL_LIMIT = 50
BREWFATHER_CONVERT_LOOKUP = { # local_name: brewfather_name
'all': {
'name': 'name',
'unit_cost': 'costPerAmount',
'supplier': 'supplier',
'notes': 'notes',
'user_notes': 'userNotes',
},
'fermentable': {
'grain_category': 'grainCategory',
'fermentable_type': 'type',
'diastatic_power': 'diastaticPower',
'potential': 'potential',
'protein': 'protein',
'attenuation': 'attenuation',
'lovibond': 'lovibond',
'max_in_batch': 'maxInBatch',
'moisture': 'moisture',
'non_fermentable': 'notFermentable',
'ibu_per_unit': 'ibuPerAmount',
},
'hop': {
'ibu': 'ibu',
'use': 'use',
'hop_type': 'type',
'alpha': 'alpha',
},
'misc': {
'use': 'use',
'misc_type': 'type',
'water_adjustment': 'waterAdjustment',
}
}
def get_batches(api_user, api_key, batch=''):
auth_string = api_user + ':' + api_key
auth64 = base64.b64encode(auth_string.encode("utf-8"))
batch_array = []
@ -19,7 +55,7 @@ def get_batches(api_user, api_key, batch=''):
lastbatch = '&start_after=' + batch
else:
lastbatch = ''
query = '{batch_url}?limit={pull_limit}&complete=True&include=recipe,recipe.batchSize&status=Planning{last_batch}'.format(
batch_url=BATCH_URL,
pull_limit=PULL_LIMIT,