Skip to main content

Fetch product tables from a McMaster-Carr URL as a DataFrame for complex filtering and calculations

Project description

McMaster-Scraper

A Python library for fetching product tables from a McMaster-Carr URL as a DataFrame for complex filtering and calculations.

PyPI - Version PyPI - Python Versions PyPI - License

Features

  • Caches data locally to speed up future calls
  • Supports both sync/async APIs
  • Works in Python files and Jupyter notebooks
  • Includes convenience functions to quickly retrieve product tables from multiple URLs
  • Typed functions for type-checking compatibility

Install

McMaster-Scraper is available on PyPi:

pip install mcmaster-scraper

McMaster-Scraper requires Playwright to fetch the product tables. It is already included as a dependency. However, you will need to install the browsers manually:

playwright install

Quick Start

To use the Sync API, import the sync_api module and call get_products_from_url(s):

from mcmaster_scraper.sync_api import get_products_from_url

url = "https://www.mcmaster.com/products/screws/socket-head-screws-2~/steel-socket-head-screws~~/"
data = get_products_from_url(url) # Returns a DataFrame with all the products from the URL

... # Do stuff with the DataFrame (filter, perform calculations, etc.)

Using the Async API is similar, import the async_api module and await the function call:

from mcmaster_scraper.async_api import get_products_from_url

url = "https://www.mcmaster.com/products/screws/socket-head-screws-2~/steel-socket-head-screws~~/"
data = await get_products_from_url(url) # Returns a DataFrame with all the products from the URL

... # Do stuff with the DataFrame (filter, perform calculations, etc.)

Docs

API Reference

The API reference can be found on GitHub Pages.

Examples

An example script can be found in docs/example.py.

Disclaimer

This library is for responsible data extraction only. Do not:

  • Scrape beyond reasonable rates
  • Violate Terms of Service
  • Circumvent access controls
  • Use data for unauthorized commercial purposes

Legal Notice

This library is provided as-is. Authors are not liable for any legal, technical, or business consequences resulting from misuse of this library. Users assume full responsibility for compliance with applicable laws, regulations, and website policies.

By using this library, you acknowledge and agree to these responsibilities.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcmaster_scraper-0.1.1.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcmaster_scraper-0.1.1-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file mcmaster_scraper-0.1.1.tar.gz.

File metadata

  • Download URL: mcmaster_scraper-0.1.1.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mcmaster_scraper-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c5fb4075f874c5f3d11f86956f58f60f2b656d72166b31bd5228a36e17661294
MD5 195e9888f65bf213c6aaa85bdbccbedd
BLAKE2b-256 c8c2ac24d92ca5bdb2e6ab40ba1bcfc83b2c2b10d59cb8199978bf9713fb58c3

See more details on using hashes here.

File details

Details for the file mcmaster_scraper-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mcmaster_scraper-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mcmaster_scraper-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 674c06fc7d0dc03a2c6e41179705822ffed2a20ffb0024ff22171bab40b2eff5
MD5 4c3dcc833a6e04d0d99aba9a76507304
BLAKE2b-256 78019b026784d8e58e86b54edafc7bc93d4033d7066d452eb4f6236b7d8efd88

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page