Giter VIP home page Giter VIP logo

sportscardtoollib's Introduction

SportsCardTool

Build Status Custom badge 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 SportsCardToolApp or ask about SportsCardToolAPI for potential new endpoints or contributions.

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 query_builder

qb = query_builder()

# Construct query requesting Barry Bonds cards from 2000 with an autograph and a print run of 25 or 250
qb.add_item({"players": "bondsba01", "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":"6467d1d3d19b3e7d748c339a",
      "all_star":false,
      "auto":true,
      "back_img":"None",
      "checklist":false,
      "debut_year":"None",
      "error":false,
      "front_img":"None",
      "leaders":false,
      "listing":"2000 Upper Deck MVP Game Used Souvenirs Signed #BBSB Barry Bonds Bat",
      "manager":false,
      "mem":true,
      "number":"BBSB",
      "parallel":false,
      "players":[
         {
            "debut_year":false,
            "last_year":2007,
            "name":"Barry Bonds Bat",
            "short_name":"bondsba01"
         }
      ],
      "price":0,
      "rc":false,
      "release":"upper-deck-mvp",
      "release_alt":"2000 ",
      "serial":25,
      "server_pop":0,
      "set":"upper-deck-mvp-game-used-souvenirs-signed-baseball-trading-card-checklist?release_name=upper-deck-mvp",
      "set_alt":"2000 Upper Deck MVP Game Used Souvenirs Signed",
      "team":"San Francisco Giants",
      "team_card":false,
      "umpire":false,
      "user_upload_links":[
         
      ],
      "year":"2000"
   },
   {
      "_id":"6467d1d3d19b3e7d748c3455",
      "all_star":false,
      "auto":true,
      "back_img":"None",
      "checklist":false,
      "debut_year":"None",
      "error":false,
      "front_img":"None",
      "leaders":false,
      "listing":"2000 Upper Deck MVP Game Used Souvenirs Signed #BBSG Barry Bonds Glove",
      "manager":false,
      "mem":true,
      "number":"BBSG",
      "parallel":false,
      "players":[
         {
            "debut_year":false,
            "last_year":2007,
            "name":"Barry Bonds Glove",
            "short_name":"bondsba01"
         }
      ],
      "price":0,
      "rc":false,
      "release":"upper-deck-mvp",
      "release_alt":"2000 ",
      "serial":25,
      "server_pop":0,
      "set":"upper-deck-mvp-game-used-souvenirs-signed-baseball-trading-card-checklist?release_name=upper-deck-mvp",
      "set_alt":"2000 Upper Deck MVP Game Used Souvenirs Signed",
      "team":"San Francisco Giants",
      "team_card":false,
      "umpire":false,
      "user_upload_links":[
         
      ],
      "year":"2000"
   },
   {
      "_id":"6467d1dcd19b3e7d748c3f24",
      "all_star":false,
      "auto":true,
      "back_img":"None",
      "checklist":false,
      "debut_year":"None",
      "error":false,
      "front_img":"None",
      "leaders":false,
      "listing":"2000 Upper Deck  Game Jersey Autograph Numbered #BB Barry Bonds",
      "manager":false,
      "mem":true,
      "number":"BB",
      "parallel":false,
      "players":[
         {
            "debut_year":false,
            "last_year":2007,
            "name":"Barry Bonds",
            "short_name":"bondsba01"
         }
      ],
      "price":0,
      "rc":false,
      "release":"upper-deck",
      "release_alt":"2000 upper",
      "serial":25,
      "server_pop":0,
      "set":"upper-deck-game-jersey-autograph-numbered-baseball-trading-card-checklist?release_name=upper-deck",
      "set_alt":"2000 Upper Deck  Game Jersey Autograph Numbered",
      "team":"San Francisco Giants",
      "team_card":false,
      "umpire":false,
      "user_upload_links":[
         
      ],
      "year":"2000"
   },
   {
      "_id":"6467d1dcd19b3e7d748c3fd6",
      "all_star":false,
      "auto":true,
      "back_img":"None",
      "checklist":false,
      "debut_year":"None",
      "error":false,
      "front_img":"None",
      "leaders":false,
      "listing":"2000 Fleer Ultra Fresh Ink #11 Barry Bonds",
      "manager":false,
      "mem":false,
      "number":"11",
      "parallel":false,
      "players":[
         {
            "debut_year":false,
            "last_year":2007,
            "name":"Barry Bonds",
            "short_name":"bondsba01"
         }
      ],
      "price":0,
      "rc":false,
      "release":"fleer-ultra",
      "release_alt":"2000 fleer",
      "serial":250,
      "server_pop":0,
      "set":"fleer-ultra-fresh-ink-baseball-trading-card-checklist?release_name=fleer-ultra",
      "set_alt":"2000 Fleer Ultra Fresh Ink",
      "team":"San Francisco Giants",
      "team_card":false,
      "umpire":false,
      "user_upload_links":[
         
      ],
      "year":"2000"
   },
   {
      "_id":"6467d1f9d19b3e7d748cb602",
      "all_star":false,
      "auto":true,
      "back_img":"None",
      "checklist":false,
      "debut_year":"None",
      "error":false,
      "front_img":"None",
      "leaders":false,
      "listing":"2000 SP Authentic Chirography Gold #GBB Barry Bonds",
      "manager":false,
      "mem":false,
      "number":"GBB",
      "parallel":false,
      "players":[
         {
            "debut_year":false,
            "last_year":2007,
            "name":"Barry Bonds",
            "short_name":"bondsba01"
         }
      ],
      "price":0,
      "rc":false,
      "release":"sp-authentic",
      "release_alt":"2000 sp",
      "serial":25,
      "server_pop":0,
      "set":"sp-authentic-chirography-gold-baseball-trading-card-checklist?release_name=sp-authentic",
      "set_alt":"2000 SP Authentic Chirography Gold",
      "team":"San Francisco Giants",
      "team_card":false,
      "umpire":false,
      "user_upload_links":[
         
      ],
      "year":"2000"
   },
   {
      "_id":"6467d203d19b3e7d748ce35c",
      "all_star":false,
      "auto":true,
      "back_img":"None",
      "checklist":false,
      "debut_year":"None",
      "error":false,
      "front_img":"None",
      "leaders":false,
      "listing":"2000 Upper Deck Pros and Prospects Game Jersey Autograph Gold #BB Barry Bonds",
      "manager":false,
      "mem":true,
      "number":"BB",
      "parallel":false,
      "players":[
         {
            "debut_year":false,
            "last_year":2007,
            "name":"Barry Bonds",
            "short_name":"bondsba01"
         }
      ],
      "price":0,
      "rc":false,
      "release":"upper-deck-pros-and-prospects",
      "release_alt":"2000 upper deck",
      "serial":25,
      "server_pop":0,
      "set":"upper-deck-pros-and-prospects-game-jersey-autograph-gold-baseball-trading-card-checklist?release_name=upper-deck-pros-and-prospects",
      "set_alt":"2000 Upper Deck Pros and Prospects Game Jersey Autograph Gold",
      "team":"San Francisco Giants",
      "team_card":false,
      "umpire":false,
      "user_upload_links":[
         
      ],
      "year":"2000"
   }
]

Development

Read the CONTRIBUTING.md file.

Attribution

This README was adapted from an example here

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.