Skip to content

Commit

Permalink
Added extra field processing to other suppliers
Browse files Browse the repository at this point in the history
  • Loading branch information
eeintech committed Apr 21, 2023
1 parent ac2c82d commit 7e5041e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions kintree/search/element14_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,15 @@ def search_timeout(timeout=10):
except TypeError:
# Parameter list is empty
pass

# Extra search fields
if settings.CONFIG_ELEMENT14.get('EXTRA_FIELDS', None):
for extra_field in settings.CONFIG_ELEMENT14['EXTRA_FIELDS']:
if part.get(extra_field, None):
part_info['parameters'][extra_field] = part[extra_field]
else:
from ..common.tools import cprint
cprint(f'[INFO]\tWarning: Extra field "{extra_field}" not found in search results', silent=False)

# Append Store URL
# Element14 support said "At this time our API is not structured to provide a URL to product pages in the selected storeInfo.id value."
Expand Down
9 changes: 9 additions & 0 deletions kintree/search/lcsc_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ def search_timeout(timeout=10):
# Parameter list is empty
pass

# Extra search fields
if settings.CONFIG_LCSC.get('EXTRA_FIELDS', None):
for extra_field in settings.CONFIG_LCSC['EXTRA_FIELDS']:
if part.get(extra_field, None):
part_info['parameters'][extra_field] = part[extra_field]
else:
from ..common.tools import cprint
cprint(f'[INFO]\tWarning: Extra field "{extra_field}" not found in search results', silent=False)

return part_info


Expand Down
9 changes: 9 additions & 0 deletions kintree/search/mouser_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@ def search_timeout():
# Append to parameters dictionary
part_info['parameters'][parameter_name] = parameter_value

# Extra search fields
if settings.CONFIG_MOUSER.get('EXTRA_FIELDS', None):
for extra_field in settings.CONFIG_MOUSER['EXTRA_FIELDS']:
if part.get(extra_field, None):
part_info['parameters'][extra_field] = part[extra_field]
else:
from ..common.tools import cprint
cprint(f'[INFO]\tWarning: Extra field "{extra_field}" not found in search results', silent=False)

return part_info


Expand Down

0 comments on commit 7e5041e

Please sign in to comment.