Skip to main content

A python tool for grabbing and tracking checklists for sports cards.

Project description

SportsCardTool

Build Status codecovPyPI

SportsCardTool is designed to gather card data and track collections of cards. We hope to build the modern dynamic checklist and price book.

Currently SportsCardTool provides the ability to gather all baseball card setlists and to search prescraped data via data API and Querybuilder tool.

Potential contributors should check out SportsCardToolServer and soon to launch SportsCardToolApp.

Install it from PyPI

pip install SportsCardTool

Usage

Scraping a year of data:

from SportsCardTool import grab_card_list, dump_data, grab_year_links

# Find All Cards for 2023 Season, returned as list of dictionaries
year_links = grab_year_links(["2023"])
card_list = grab_card_list(year_link)

# Create CSV to allow for manipulation via pandas
dump_data(mock_data, "2023_cards.csv")

Grabbing cards from scraped data via code: Also accessible directly here!

from SportsCardTool import QueryBuilder

qb = QueryBuilder()

# Construct query requesting Barry Bonds cards from 2000 with an autograph and a print run of 25 or 250
qb.add_item({"name": "Barry Bonds", "year": "2000", "auto": "True", "serial": "25,250"})

# Make request and return in form of tuple (list[dict], int)
data = qb.grab_data()

print(data[0])
[
    {
      "_id": "641f49185ee984b20a66ef77",
      "auto": true,
      "back_img": null,
      "front_img": null,
      "group": "fleer-ultra",
      "listing": "2000 Fleer Ultra Fresh Ink #11 Barry Bonds",
      "mem": false,
      "name": "Barry Bonds",
      "number": "11",
      "price": 0,
      "rc": false,
      "serial": 250,
      "set": "fleer-ultra-fresh-ink-baseball-trading-card-checklist",
      "team": "San Francisco Giants",
      "year": 2000
    },
    {
      "_id": "641f49185ee984b20a66f5f4",
      "auto": true,
      "back_img": null,
      "front_img": null,
      "group": "fleer-ultra",
      "listing": "2000 Fleer Ultra Fresh Ink #11 Barry Bonds",
      "mem": false,
      "name": "Barry Bonds",
      "number": "11",
      "price": 0,
      "rc": false,
      "serial": 250,
      "set": "fleer-ultra-fresh-ink-baseball-trading-card-checklist",
      "team": "San Francisco Giants",
      "year": 2000
    },
    {
      "_id": "641f49185ee984b20a674b2f",
      "auto": true,
      "back_img": null,
      "front_img": null,
      "group": "upper-deck",
      "listing": "2000 Upper Deck  Game Jersey Autograph Numbered #BB Barry Bonds",
      "mem": true,
      "name": "Barry Bonds",
      "number": "BB",
      "price": 0,
      "rc": false,
      "serial": 25,
      "set": "upper-deck-game-jersey-autograph-numbered-baseball-trading-card-checklist",
      "team": "San Francisco Giants",
      "year": 2000
    },
    {
      "_id": "641f49185ee984b20a678e31",
      "auto": true,
      "back_img": null,
      "front_img": null,
      "group": "upper-deck-pros-and-prospects",
      "listing": "2000 Upper Deck Pros and Prospects Game Jersey Autograph Gold #BB Barry Bonds",
      "mem": true,
      "name": "Barry Bonds",
      "number": "BB",
      "price": 0,
      "rc": false,
      "serial": 25,
      "set": "upper-deck-pros-and-prospects-game-jersey-autograph-gold-baseball-trading-card-checklist",
      "team": "San Francisco Giants",
      "year": 2000
    },
    {
      "_id": "641f49185ee984b20a67958c",
      "auto": true,
      "back_img": null,
      "front_img": null,
      "group": "sp-authentic",
      "listing": "2000 SP Authentic Chirography Gold #GBB Barry Bonds",
      "mem": false,
      "name": "Barry Bonds",
      "number": "GBB",
      "price": 0,
      "rc": false,
      "serial": 25,
      "set": "sp-authentic-chirography-gold-baseball-trading-card-checklist",
      "team": "San Francisco Giants",
      "year": 2000
    }
]

Development

Read the CONTRIBUTING.md file.

Attribution

This README was adapted from an example here

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

SportsCardTool-0.2.4.tar.gz (601.6 kB view hashes)

Uploaded Source

Built Distribution

SportsCardTool-0.2.4-py3-none-any.whl (621.8 kB view hashes)

Uploaded Python 3

Supported by

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