diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2019-03-23 07:29:49 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2019-03-23 07:32:10 +0100 |
commit | 689508e07dba890fff8d1cd06e0029eca1c30994 (patch) | |
tree | 50898ade69fc853bf7310ee002767ba3990ae86a /src/ee/digikey/search_parts.py | |
parent | 1fe278b37b4031a42f8e27ee4f3251b474efcb16 (diff) | |
download | ee-python-689508e07dba890fff8d1cd06e0029eca1c30994.tar.gz ee-python-689508e07dba890fff8d1cd06e0029eca1c30994.tar.bz2 ee-python-689508e07dba890fff8d1cd06e0029eca1c30994.tar.xz ee-python-689508e07dba890fff8d1cd06e0029eca1c30994.zip |
xsd:
o Adding <link> list on <part>. For media, datasheets etc.
digikey:
o Parsing out media.
PartDb:
o starting on a more generic object db with indexes.
order:
o Using the new object db for building data while resolving parts.
o Creating a report from the order.
Diffstat (limited to 'src/ee/digikey/search_parts.py')
-rw-r--r-- | src/ee/digikey/search_parts.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/ee/digikey/search_parts.py b/src/ee/digikey/search_parts.py index 3d271d5..358266a 100644 --- a/src/ee/digikey/search_parts.py +++ b/src/ee/digikey/search_parts.py @@ -13,9 +13,19 @@ def resolved(p: DigikeyProduct) -> types.Part: # TODO: fix uri part = types.Part(uri="https://digikey.com/pn#{}".format(p.part_number), distributor_info=types.DistributorInfo(), + links=types.LinkList(), facts=types.FactList(), references=types.ReferencesList()) part.distributor_infoProp.stateProp = "resolved" + links = part.linksProp.link + + if p.url: + links.append(types.Link(url=p.url, relation="canonical", media_type="text/html")) + + for d in p.documents: + title = "{}: {}".format(d.kind, d.title) + links.append(types.Link(url=d.url, relation="http://purl.org/ee/link-relation#documentation", + media_type="text/html", title=title)) supplier_part_numbers = part.referencesProp.supplier_part_numberProp supplier_part_numbers.append(types.SupplierPartNumber(value=p.part_number, supplier=DIGIKEY_URI)) @@ -48,7 +58,8 @@ def search_parts(in_path: Path, out_path: Path, cache_dir: Path): client = DigikeyClient(cache_dir) for part in in_db.iterparts(): - dpn = next((p.valueProp for p in bom_file_utils.supplier_part_numbers(part) if p.supplierProp == DIGIKEY_URI), None) + dpn = next((p.valueProp for p in bom_file_utils.supplier_part_numbers(part) + if p.supplierProp == DIGIKEY_URI), None) mpn = next((p.valueProp for p in bom_file_utils.part_numbers(part)), None) is_mpn = query = None |