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.2.0.tar.gz (6.8 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.2.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mcmaster_scraper-0.2.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.13 {"installer":{"name":"uv","version":"0.11.13","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.2.0.tar.gz
Algorithm Hash digest
SHA256 ba341946c24d266fb614e29752422bba0de0072caffdd6b871fa102f50cc4d45
MD5 e5679f45e4aa7be7be8630489167a8ac
BLAKE2b-256 552b73be97e63c0b894c9d4f7ac1b80f06f42c1e56c0a0d657ffa9cbec0eb32d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcmaster_scraper-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.13 {"installer":{"name":"uv","version":"0.11.13","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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dcab2b90ea2568feb38a31b8b4a1aa61dd58458b697985af5f9b5b828ae8b070
MD5 95e13febc7492cf66c8d303fb5dfd7ee
BLAKE2b-256 f65dff0b8c5738c1e720dcca109da3b771088e40bf27fa80e850ea5852e8ae1e

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