Skip to content

AlexSartori/pymouser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyMouser

Installation

Install the package with pip.

pip install --user pymouser

Usage:

import pymouser


# Initialize the package with your API key
mouser = pymouser.MouserAPI('your-search-key')

# Search by Part-Number
err, res = mouser.search_by_PN('your-part-number')

# Check for errors or print the returned results
if err:
    print("Error during request:")
    print(err)
else:
    if res['NumberOfResult'] == 0:
        print("No results matched the part number")
    else:
        for match in res['Parts']:
            print("Match for PartNumber .... %s" % match['MouserPartNumber'])
            print("Description ............. %s" % match['Description'])
            print("Link to datasheet ....... %s" % match['DataSheetUrl'])
            print("Link to product page .... %s" % match['ProductDetailUrl'])
            print("")