Skip to main content

A simple python package that provides easy access to NFL stadium data

Project description

NFLTeamStadiums

A simple python package that provides easy access to NFL stadium data such as capacity, location, and weather.

Installation

pip install nfl-stadiums

Instantiation

from nfl_stadiums import NFLStadiums

# Use cache if available by default
stad = NFLStadiums()

# Force new retrieval
stad = NFLStadiums(use_cache=False)

# Don't print
stad = NFLStadiums(verbose=False)

Example Usage

stadiums = stad.get_list_of_stadium_names()

lions_stadium_data = stad.get_stadium_by_team("lions")

stadium_data = stad.get_stadium_by_name("ford field")

coords = stad.get_stadium_coordinates_by_team("lions")

coords = stad.get_stadium_coordinates_by_name("ford field")

miles = stad.calculate_distance_between_stadiums("lions", "rams")

forecast = stad.get_weather_forecast_for_stadium('lions', '2024-05-30')

# Change parameters
forecast = stad.get_weather_forecast_for_stadium("rams", "2025/02/24", hour_start=9, hour_end=15, day_format="%Y/%m/%d")

Stadium Data Example

{
    "name": "Ford Field",
    "capacity": 65000,
    "imgUrl": "https://en.wikipedia.org/wiki/File:Packers_at_Lions_Dec_2020_(50715608723).jpg",
    "city": "Detroit, Michigan",
    "surface": "FieldTurf CORE",
    "roofType": "Fixed",
    "teams": [
        "Detroit Lions"
    ],
    "yearOpened": 2002,
    "sharedStadium": false,
    "currentTeams": [
        "DET"
    ],
    "coordinates": {
        "lat": 42.34,
        "lon": -83.04555556,
        "primary": "",
        "globe": "earth"
    }
}

Weather Data Example

{
    "latitude": 42.351395, 
    "longitude": -83.06134, 
    "generationtime_ms": 0.10704994201660156, 
    "utc_offset_seconds": -14400, 
    "timezone": "America/New_York", 
    "timezone_abbreviation": "EDT", 
    "elevation": 188.0, 
    "hourly_units": 
        {
            "time": "iso8601", 
            "temperature_2m": "°F", 
            "apparent_temperature": "°F", 
            "precipitation_probability": "%", 
            "precipitation": "inch", 
            "rain": "inch", 
            "showers": "inch", 
            "snowfall": "inch", 
            "snow_depth": "ft", 
            "wind_speed_10m": "mp/h", 
            "wind_speed_80m": "mp/h", 
            "wind_direction_10m": "°"
        }, 
    "hourly": 
        {
            "time": ["2024-05-30T00:00", "2024-05-30T01:00", "2024-05-30T02:00"], 
            "temperature_2m": [50.0, 48.6, 47.3], 
            "apparent_temperature": [44.8, 43.4, 43.0], 
            "precipitation_probability": [0, 0, 0], 
            "precipitation": [0.0, 0.0, 0.0], 
            "rain": [0.0, 0.0, 0.0], 
            "showers": [0.0, 0.0, 0.0], 
            "snowfall": [0.0, 0.0, 0.0], 
            "snow_depth": [0.0, 0.0, 0.0], 
            "wind_speed_10m": [4.4, 3.5, 2.2], 
            "wind_speed_80m": [13.5, 11.1, 10.3], 
            "wind_direction_10m": [15, 18, 323]
        }
}

Data and Usage

YOU ARE RESPONSIBLE FOR HOW YOU ACCESS AND USE THE DATA. This package utilizes the Wikipedia API to retrieve NFL stadium data and Open-Meteo.com for weather information. Stadium data is fairly static, so by default, this class will save the data retrieved from Wikipedia locally for subsequent uses for quicker access and less load on Wikipedia.

You are Responsible for How You Access and Use The Data

Wikipedia Data

The core page is here. Wikipedia content is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. For more details on the terms of use, please refer to the Wikimedia Foundation's Terms of Use.

Open Meteo

This package utilizes the Open_Meteo.com API found here. See their terms of use here.

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

nfl_stadiums-2.0.1.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

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

nfl_stadiums-2.0.1-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file nfl_stadiums-2.0.1.tar.gz.

File metadata

  • Download URL: nfl_stadiums-2.0.1.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for nfl_stadiums-2.0.1.tar.gz
Algorithm Hash digest
SHA256 44d795d73f2a7e3ad734b3aefe947d3a5ec2bb65c73108f2a31e589f542da20f
MD5 3e1ae5287b34dbc726ccc6742473da4d
BLAKE2b-256 e23ef98c770d99703f39e65498d9c5ff974dadaa3ea72b231b7fe1eb6bc527af

See more details on using hashes here.

File details

Details for the file nfl_stadiums-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: nfl_stadiums-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for nfl_stadiums-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9a46a49075d3e6dcc6ddddac84c4f3f78fa9d807e756bcff3d2fa6e409376615
MD5 03a58841aa774743755a797cb69b6a9b
BLAKE2b-256 3f12af2db5f71ada0a91af94180995fcbf8a88227d76cf5581610f8ff6228603

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