From a9c3c2c480d8b68279913d6e68ef2ff57802c1da Mon Sep 17 00:00:00 2001 From: Fred Z Date: Thu, 9 Aug 2018 13:20:03 +0200 Subject: [PATCH] Updates comments --- function.py | 8 ++++---- populate-db.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/function.py b/function.py index 99d4cd5..da58e87 100644 --- a/function.py +++ b/function.py @@ -6,7 +6,7 @@ Author: freezed 2018-07-24 Version: 0.1 Licence: `GNU GPL v3` GNU GPL v3: http://www.gnu.org/licenses/ -Call OpenFF API to populate a local MariaDB/MySQL database with product data +Call Open Food Facts API to populate a local MariaDB/MySQL database with product data This DB will serve an CLI client which gives alternative products with better nurition grade. """ @@ -17,7 +17,7 @@ from config import FIELD_KEPT, API_URL_CAT def get_product(code, from_file=False): """ - Call OpenFF API to get data of a single product + Call Open Food Facts API to get data of a single product :Tests ONLINE: # >>> prod_beurre = get_product('3017760000109') @@ -116,7 +116,7 @@ def get_product(code, from_file=False): def get_category(name, from_file=False): """ - Call OpenFF API to get data of products in a single category + Call Open Food Facts API to get data of products in a single category :return: Dict filled with products & kept fields @@ -216,7 +216,7 @@ def get_category(name, from_file=False): staging_data['products'].append(dict()) for field in FIELD_KEPT['category']: - # import pdb; pdb.set_trace() + if field in product_fields: staging_data['products'][idx][field] = product_fields[field] diff --git a/populate-db.py b/populate-db.py index b9ce889..ac011f6 100644 --- a/populate-db.py +++ b/populate-db.py @@ -6,7 +6,7 @@ Author: freezed 2018-08-02 Version: 0.1 Licence: `GNU GPL v3` GNU GPL v3: http://www.gnu.org/licenses/ -Populates local DB with data comming from OpenFF API +Populates local DB with data comming from Open Food Facts API :Tests: >>> CATEGORY_LIST.append('falsecategory') @@ -28,13 +28,13 @@ for category in CATEGORY_LIST: print(POP_MSG_TEMPLATE['work'].format(category)) print(POP_MSG_TEMPLATE['fetch']) - # get data + # gets data staging_data = get_category(category) - # generate SQL + # generates SQL sql_list = sql_generator(staging_data) - # execute SQL + # executes SQL print(POP_MSG_TEMPLATE['insert'].format(category)) if sql_list is False: