Last active
June 9, 2023 15:12
-
-
Save Bouni/3d79ddbd68b8fccceb196ad5c9598f1f to your computer and use it in GitHub Desktop.
LCSC API python example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pprint import PrettyPrinter | |
| import requests | |
| pp = PrettyPrinter() | |
| def query(number) | |
| url = f"https://wwwapi.lcsc.com/v1/products/detail?product_code={number}" | |
| r = requests.get(url) | |
| pp.pprint(r.json()) | |
| if __name__ == "__main__": | |
| query("C4410") | |
| # Result is: | |
| """ | |
| {'allHotLevel': None, | |
| 'brandCategory': 1, | |
| 'brandId': 99, | |
| 'brandNameEn': 'UNI-ROYAL(Uniroyal Elec)', | |
| 'catalogId': 439, | |
| 'catalogName': 'Chip Resistor - Surface Mount', | |
| 'encapStandard': '1206', | |
| 'foreignWeight': 0, | |
| 'isAutoOffsale': None, | |
| 'isEnvironment': True, | |
| 'isFavorite': False, | |
| 'isForeignOnsale': True, | |
| 'isHasBattery': False, | |
| 'isHot': False, | |
| 'isPreSale': False, | |
| 'isReel': True, | |
| 'maxBuyNumber': -1, | |
| 'minBuyNumber': 50, | |
| 'minPacketNumber': 5000, | |
| 'minPacketUnit': 'Reel', | |
| 'paramVOList': [{'isMain': True, | |
| 'paramCode': 'param_10837_n', | |
| 'paramDetailValue': None, | |
| 'paramDetailValueForSearch': 0.25, | |
| 'paramName': '功率', | |
| 'paramNameEn': 'Power(Watts)', | |
| 'paramSearchType': 'attr', | |
| 'paramType': 'param_detail', | |
| 'paramUnit': None, | |
| 'paramValueEn': '0.25W'}, | |
| {'isMain': True, | |
| 'paramCode': 'param_10836', | |
| 'paramDetailValue': '±1%', | |
| 'paramDetailValueForSearch': -1, | |
| 'paramName': '精度', | |
| 'paramNameEn': 'Tolerance', | |
| 'paramSearchType': None, | |
| 'paramType': None, | |
| 'paramUnit': None, | |
| 'paramValueEn': '±1%'}, | |
| {'isMain': True, | |
| 'paramCode': 'param_10847_s', | |
| 'paramDetailValue': '±100ppm/℃', | |
| 'paramDetailValueForSearch': None, | |
| 'paramName': '温度系数', | |
| 'paramNameEn': 'Temperature Coefficient', | |
| 'paramSearchType': None, | |
| 'paramType': 'param_detail', | |
| 'paramUnit': None, | |
| 'paramValueEn': '±100ppm/℃'}, | |
| {'isMain': True, | |
| 'paramCode': 'param_10835_n', | |
| 'paramDetailValue': None, | |
| 'paramDetailValueForSearch': 1000, | |
| 'paramName': '阻值', | |
| 'paramNameEn': 'Resistance', | |
| 'paramSearchType': 'attr', | |
| 'paramType': 'param_detail', | |
| 'paramUnit': None, | |
| 'paramValueEn': '1kΩ'}], | |
| 'parentCatalogId': 308, | |
| 'parentCatalogName': 'Resistors', | |
| 'pdfUrl': 'https://datasheet.lcsc.com/lcsc/1810242121_UNI-ROYAL-Uniroyal-Elec-1206W4F1001T5_C4410.pdf', | |
| 'productArrange': 'Tape & Reel (TR)', | |
| 'productCode': 'C4410', | |
| 'productDescEn': None, | |
| 'productId': 4817, | |
| 'productImages': ['https://assets.lcsc.com/images/lcsc/900x900/20190225_UNI-ROYAL-Uniroyal-Elec-1206W4F1001T5_C4410_front.jpg', | |
| 'https://assets.lcsc.com/images/lcsc/900x900/20190225_UNI-ROYAL-Uniroyal-Elec-1206W4F1001T5_C4410_back.jpg', | |
| 'https://assets.lcsc.com/images/lcsc/900x900/20190225_UNI-ROYAL-Uniroyal-Elec-1206W4F1001T5_C4410_blank.jpg'], | |
| 'productIntroEn': '0.25W ±1% ±100ppm/℃ 1kΩ 1206 Chip Resistor - Surface Mount ' | |
| 'ROHS', | |
| 'productModel': '1206W4F1001T5', | |
| 'productPriceList': [{'currencyPrice': 0.0046, | |
| 'currencySymbol': 'US$', | |
| 'discountRate': None, | |
| 'ladder': 50, | |
| 'usdPrice': 0.0046}, | |
| {'currencyPrice': 0.0034, | |
| 'currencySymbol': 'US$', | |
| 'discountRate': None, | |
| 'ladder': 500, | |
| 'usdPrice': 0.0034}, | |
| {'currencyPrice': 0.0032, | |
| 'currencySymbol': 'US$', | |
| 'discountRate': None, | |
| 'ladder': 1500, | |
| 'usdPrice': 0.0032}, | |
| {'currencyPrice': 0.003, | |
| 'currencySymbol': 'US$', | |
| 'discountRate': None, | |
| 'ladder': 5000, | |
| 'usdPrice': 0.003}, | |
| {'currencyPrice': 0.0029, | |
| 'currencySymbol': 'US$', | |
| 'discountRate': None, | |
| 'ladder': 25000, | |
| 'usdPrice': 0.0029}, | |
| {'currencyPrice': 0.0028, | |
| 'currencySymbol': 'US$', | |
| 'discountRate': None, | |
| 'ladder': 50000, | |
| 'usdPrice': 0.0028}], | |
| 'productUnit': 'Piece', | |
| 'productWeight': 0.03, | |
| 'recommend': [{'brandId': 99, | |
| 'brandNameEn': 'UNI-ROYAL(Uniroyal Elec)', | |
| 'catalogId': 439, | |
| 'catalogNameEn': 'Chip Resistor - Surface Mount', | |
| 'currencyPrice': 0.0014, | |
| 'isDiscount': True, | |
| 'isHot': False, | |
| 'ladderDiscountRate': '0.95', | |
| 'minPacketNumber': 5000, | |
| 'productCode': 'C4184', | |
| 'productImageUrl': 'https://assets.lcsc.com/images/lcsc/224x224/20180914_UNI-ROYAL-Uniroyal-Elec-0603WAF2002T5E_C4184_front_10.jpg', | |
| 'productLadder': 100, | |
| 'productLadderPrice': 0.0014, | |
| 'productModel': '0603WAF2002T5E', | |
| 'size': None, | |
| 'split': 100}, | |
| {'brandId': 111, | |
| 'brandNameEn': 'RALEC', | |
| 'catalogId': 439, | |
| 'catalogNameEn': 'Chip Resistor - Surface Mount', | |
| 'currencyPrice': 0.0088, | |
| 'isDiscount': False, | |
| 'isHot': False, | |
| 'ladderDiscountRate': None, | |
| 'minPacketNumber': 5000, | |
| 'productCode': 'C4436', | |
| 'productImageUrl': 'https://assets.lcsc.com/images/lcsc/224x224/20180914_RALEC-RTT061602FTP_C4436_front.jpg', | |
| 'productLadder': 50, | |
| 'productLadderPrice': 0.0088, | |
| 'productModel': 'RTT061602FTP', | |
| 'size': None, | |
| 'split': 50}, | |
| {'brandId': 121, | |
| 'brandNameEn': 'PANASONIC', | |
| 'catalogId': 439, | |
| 'catalogNameEn': 'Chip Resistor - Surface Mount', | |
| 'currencyPrice': 0.2021, | |
| 'isDiscount': True, | |
| 'isHot': False, | |
| 'ladderDiscountRate': '0.6', | |
| 'minPacketNumber': 5000, | |
| 'productCode': 'C88095', | |
| 'productImageUrl': 'https://assets.lcsc.com/images/lcsc/224x224/20190903_PANASONIC-ERA6AEB2871V_C88095_front.jpg', | |
| 'productLadder': 1, | |
| 'productLadderPrice': 0.2021, | |
| 'productModel': 'ERA6AEB2871V', | |
| 'size': None, | |
| 'split': 1}, | |
| {'brandId': 63, | |
| 'brandNameEn': 'FH(Guangdong Fenghua Advanced Tech)', | |
| 'catalogId': 439, | |
| 'catalogNameEn': 'Chip Resistor - Surface Mount', | |
| 'currencyPrice': 0.0018, | |
| 'isDiscount': True, | |
| 'isHot': False, | |
| 'ladderDiscountRate': '0.95', | |
| 'minPacketNumber': 5000, | |
| 'productCode': 'C115295', | |
| 'productImageUrl': 'https://assets.lcsc.com/images/lcsc/224x224/20180914_FH-Guangdong-Fenghua-Advanced-Tech-RS-05K103JT_C115295_front_10.jpg', | |
| 'productLadder': 100, | |
| 'productLadderPrice': 0.0018, | |
| 'productModel': 'RS-05K103JT', | |
| 'size': None, | |
| 'split': 100}, | |
| {'brandId': 91, | |
| 'brandNameEn': 'Vishay Intertech', | |
| 'catalogId': 439, | |
| 'catalogNameEn': 'Chip Resistor - Surface Mount', | |
| 'currencyPrice': 0.3175, | |
| 'isDiscount': True, | |
| 'isHot': False, | |
| 'ladderDiscountRate': '0.80', | |
| 'minPacketNumber': 4000, | |
| 'productCode': 'C110202', | |
| 'productImageUrl': 'https://assets.lcsc.com/images/lcsc/224x224/20180914_Vishay-Intertech-CRCW12068R06FKEA_C110202_front_10.jpg', | |
| 'productLadder': 1, | |
| 'productLadderPrice': 0.3175, | |
| 'productModel': 'CRCW12068R06FKEA', | |
| 'size': None, | |
| 'split': 1}], | |
| 'recommendRight': [{'brandNameEn': 'NXP Semicon', | |
| 'catalogNameEn': '', | |
| 'currencyPrice': 79.1928, | |
| 'productCode': 'C843788', | |
| 'productImageUrl': 'https://assets.lcsc.com/images/lcsc/96x96/20201118_NXP-Semicon-LPC1768FBD100K_C843788_front.jpg', | |
| 'productModel': 'LPC1768FBD100K'}, | |
| {'brandNameEn': 'MOLEX', | |
| 'catalogNameEn': '', | |
| 'currencyPrice': 0.4869, | |
| 'productCode': 'C586226', | |
| 'productImageUrl': 'https://assets.lcsc.com/images/lcsc/96x96/20200718_MOLEX-1051330011_C586226_front.jpg', | |
| 'productModel': '1051330011'}, | |
| {'brandNameEn': 'MXIC(Macronix)', | |
| 'catalogNameEn': '', | |
| 'currencyPrice': 1.8556, | |
| 'productCode': 'C701355', | |
| 'productImageUrl': 'https://assets.lcsc.com/images/lcsc/96x96/20200731_MXIC-Macronix-MX25L12833FM2I-10G_C701355_front.jpg', | |
| 'productModel': 'MX25L12833FM2I-10G'}, | |
| {'brandNameEn': 'MOLEX', | |
| 'catalogNameEn': '', | |
| 'currencyPrice': 0.7791, | |
| 'productCode': 'C485572', | |
| 'productImageUrl': 'https://assets.lcsc.com/images/lcsc/96x96/20200413_MOLEX-430451212_C485572_front.jpg', | |
| 'productModel': '430451212'}, | |
| {'brandNameEn': 'Microchip Tech', | |
| 'catalogNameEn': '', | |
| 'currencyPrice': 0.6438, | |
| 'productCode': 'C6487', | |
| 'productImageUrl': 'https://assets.lcsc.com/images/lcsc/96x96/20190221_Microchip-Tech-AT24C64D-SSHM-T_C6487_front.jpg', | |
| 'productModel': 'AT24C64D-SSHM-T'}, | |
| {'brandNameEn': 'MOLEX', | |
| 'catalogNameEn': '', | |
| 'currencyPrice': 0.0794, | |
| 'productCode': 'C504989', | |
| 'productImageUrl': 'https://assets.lcsc.com/images/lcsc/96x96/20200406_MOLEX-530470410_C504989_front.jpg', | |
| 'productModel': '530470410'}, | |
| {'brandNameEn': 'Texas Instruments', | |
| 'catalogNameEn': '', | |
| 'currencyPrice': 0.8782, | |
| 'productCode': 'C39159', | |
| 'productImageUrl': 'https://assets.lcsc.com/images/lcsc/96x96/20180921_Texas-Instruments-DRV8837DSGR_C39159_front.jpg', | |
| 'productModel': 'DRV8837DSGR'}, | |
| {'brandNameEn': 'MOLEX', | |
| 'catalogNameEn': '', | |
| 'currencyPrice': 0.3098, | |
| 'productCode': 'C122431', | |
| 'productImageUrl': 'https://assets.lcsc.com/images/lcsc/96x96/20180914_MOLEX-430450200_C122431_front.jpg', | |
| 'productModel': '430450200'}, | |
| {'brandNameEn': 'MOLEX', | |
| 'catalogNameEn': '', | |
| 'currencyPrice': 0.7412, | |
| 'productCode': 'C114097', | |
| 'productImageUrl': 'https://assets.lcsc.com/images/lcsc/96x96/20180914_MOLEX-670688000_C114097_front_10.jpg', | |
| 'productModel': '670688000'}, | |
| {'brandNameEn': 'MOLEX', | |
| 'catalogNameEn': '', | |
| 'currencyPrice': 0.0619, | |
| 'productCode': 'C114130', | |
| 'productImageUrl': 'https://assets.lcsc.com/images/lcsc/96x96/20180914_MOLEX-0530470210_C114130_front_10.jpg', | |
| 'productModel': '0530470210'}, | |
| {'brandNameEn': 'MOLEX', | |
| 'catalogNameEn': '', | |
| 'currencyPrice': 0.5735, | |
| 'productCode': 'C277661', | |
| 'productImageUrl': 'https://assets.lcsc.com/images/lcsc/96x96/20190111_MOLEX-430450812_C277661_front.jpg', | |
| 'productModel': '430450812'}, | |
| {'brandNameEn': 'Texas Instruments', | |
| 'catalogNameEn': '', | |
| 'currencyPrice': 6.2755, | |
| 'productCode': 'C22206', | |
| 'productImageUrl': 'https://assets.lcsc.com/images/lcsc/96x96/20200723_Texas-Instruments-CC2541F256RHAR_C22206_front.jpg', | |
| 'productModel': 'CC2541F256RHAR'}, | |
| {'brandNameEn': 'Texas Instruments', | |
| 'catalogNameEn': '', | |
| 'currencyPrice': 4.8761, | |
| 'productCode': 'C29953', | |
| 'productImageUrl': 'https://assets.lcsc.com/images/lcsc/96x96/20200723_Texas-Instruments-CC1101RGPR_C29953_front.jpg', | |
| 'productModel': 'CC1101RGPR'}, | |
| {'brandNameEn': 'MOLEX', | |
| 'catalogNameEn': '', | |
| 'currencyPrice': 0.1254, | |
| 'productCode': 'C99277', | |
| 'productImageUrl': 'https://assets.lcsc.com/images/lcsc/96x96/20180914_MOLEX-532610671_C99277_front.jpg', | |
| 'productModel': '532610671'}], | |
| 'reelPrice': 3, | |
| 'split': 50, | |
| 'stockJs': 8800, | |
| 'stockNumber': 10250, | |
| 'stockSz': 1450, | |
| 'title': 'UNI-ROYAL(Uniroyal Elec) 1206W4F1001T5', | |
| 'videos': [{'cover': 'https://assets.lcsc.com/attachment/video/video_5aa6457f745c4e40afad88d5c155206c.jpg', | |
| 'detail': 'How do LCSC Electronics staffs pick Chip Resistor?', | |
| 'url': 'https://assets.lcsc.com/attachment/video/video_af74a1c68b104e24896aa158dc3a9147.mp4'}, | |
| {'cover': 'https://assets.lcsc.com/attachment/video/video_bcb79d9f1c6146d1a94a2c9884ce55bb.jpg', | |
| 'detail': 'See how to pick SMD resistors at LCSC', | |
| 'url': 'https://assets.lcsc.com/attachment/video/video_c901d3970be640ca8b2133bc13dcd76e.mp4'}], | |
| 'weight': 0.03} | |
| """ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment