Skip to content

Commit

Permalink
Merge pull request #4 from armstjc/0.0.3-The-Coaches-Update
Browse files Browse the repository at this point in the history
0.0.3: The "Coaches" Update.
  • Loading branch information
armstjc authored Sep 30, 2023
2 parents 9d1f2c2 + e967b18 commit c6fe119
Show file tree
Hide file tree
Showing 5 changed files with 507 additions and 71 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,7 @@ cython_debug/

# test files
test.py
test.json
test.json

# VS Code Counter
.VSCodeCounter*
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# CHANGELOG: cfbd_json_py

## 0.0.3: The "Coaches" Update.

- Implemented `get_cfbd_coaches_info()`, a function that allows a user to get CFB head coach information from a specified season, timeframe, team, or name.
- Updated the sample script found in the help guide for `get_cfbd_betting_lines()`.
- Fixed a bug in `get_cfbd_betting_lines()` that would always result in the function not recognizing if the inputed `api_key` is the placeholder key inside the sample script for this function.
- Updated the package version to `0.0.3`

## 0.0.2: The "Betting" Update.

- Removed the option to cache data. This may be implemented in a future version.
Expand Down
176 changes: 115 additions & 61 deletions cfbd_json_py/betting.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,42 +110,76 @@ def get_cfbd_betting_lines(
if cfbd_key != "tigersAreAwsome":
print("Using the user's API key declared in this script for this example.\n\n")
# Gets all betting info for the 2020 CFB season
print(get_cfbd_betting_lines(api_key=cfbd_key, season=2020))
# Gets all available betting info for the 2020 CFB season.
print("Gets all available betting info for the 2020 CFB season.")
json_data = get_cfbd_betting_lines(
api_key=cfbd_key,
season=2020
)
print(json_data)
time.sleep(5)
print("")
# Gets all betting info for the 2020 CFB season, in week 2.
print(get_cfbd_betting_lines(api_key=cfbd_key, season=2020, week=2))
# Gets all available betting info for the 2020 CFB season, in week 2.
print("Gets all available betting info for the 2020 CFB season, in week 2.")
json_data = get_cfbd_betting_lines(
api_key=cfbd_key,
season=2020,
week=2
)
print(json_data)
time.sleep(5)
print("")
# Gets all betting info for the 2020 CFB season, in the postseason (bowls, playoffs, etc.)
print(get_cfbd_betting_lines(api_key=cfbd_key, season=2020, season_type="postseason"))
# Gets all betting info for the 2020 CFB season, in the postseason (bowls, playoffs, etc.).
print("Gets all betting info for the 2020 CFB season, in the postseason (bowls, playoffs, etc.).")
json_data = get_cfbd_betting_lines(
api_key=cfbd_key,
season=2020,
season_type="postseason"
)
print(json_data)
time.sleep(5)
print("")
# Gets all betting info for Cincinnati Bearcats Football games the 2020 CFB season
print(get_cfbd_betting_lines(api_key=cfbd_key, season=2020, team="Cincinnati"))
# Gets all betting info for Cincinnati Bearcats Football games the 2020 CFB season.
print("Gets all betting info for Cincinnati Bearcats Football games the 2020 CFB season.")
json_data = get_cfbd_betting_lines(
api_key=cfbd_key,
season=2020,
team="Cincinnati"
)
print(json_data)
time.sleep(5)
print("")
# Gets all betting info for Ohio Bobcats home games the 2020 CFB season
print(get_cfbd_betting_lines(api_key=cfbd_key, season=2020, home_team="Ohio"))
# Gets all betting info for Ohio Bobcats home games the 2020 CFB season.
print("Gets all betting info for Ohio Bobcats home games the 2020 CFB season.")
json_data = get_cfbd_betting_lines(
api_key=cfbd_key,
season=2020,
home_team="Ohio"
)
print(json_data)
time.sleep(5)
print("")
# Gets all betting info for Ohio State Buckeyes away games the 2020 CFB season
print(get_cfbd_betting_lines(api_key=cfbd_key,
season=2020, away_team="Ohio State"))
# Gets all betting info for Ohio State Buckeyes away games the 2020 CFB season.
print("Gets all betting info for Ohio State Buckeyes away games the 2020 CFB season.")
json_data = get_cfbd_betting_lines(
api_key=cfbd_key,
season=2020,
away_team="Ohio State"
)
# Gets all betting info for Atlantic Coast Conference (ACC) games the 2020 CFB season
print(get_cfbd_betting_lines(api_key=cfbd_key, year=2020, conference_abv="ACC"))
# Gets all betting info for Atlantic Coast Conference (ACC) games the 2020 CFB season.
print("Gets all betting info for Atlantic Coast Conference (ACC) games the 2020 CFB season.")
json_data = get_cfbd_betting_lines(
api_key=cfbd_key,
season=2020,
conference_abv="ACC"
)
print(json_data)
time.sleep(5)
print("")
# You can also tell this function to just return the API call as a Dictionary (read: JSON) object.
print(get_cfbd_betting_lines(api_key=cfbd_key, year=2020, return_as_dict=True))
print("You can also tell this function to just return the API call as a Dictionary (read: JSON) object.")
json_data = get_cfbd_betting_lines(
api_key=cfbd_key,
season=2020,
return_as_dict=True
)
print(json_data)
else:
# Alternatively, if the CFBD API key exists in this python environment,
Expand All @@ -154,48 +188,68 @@ def get_cfbd_betting_lines(
# in the script.
print("Using the user's API key suposedly loaded into this python environment for this example.\n\n")
# Gets all betting info for the 2020 CFB season
print(get_cfbd_betting_lines(season=2020))
time.sleep(5)
print("")
# Gets all betting info for the 2020 CFB season, in week 2.
print(get_cfbd_betting_lines(season=2020, week=2))
# Gets all available betting info for the 2020 CFB season.
print("Gets all available betting info for the 2020 CFB season.")
json_data = get_cfbd_betting_lines(
season=2020
)
print(json_data)
time.sleep(5)
print("")
# Gets all betting info for the 2020 CFB season, in the postseason (bowls, playoffs, etc.)
print(get_cfbd_betting_lines(season=2020, season_type="postseason"))
# Gets all available betting info for the 2020 CFB season, in week 2.
print("Gets all available betting info for the 2020 CFB season, in week 2.")
json_data = get_cfbd_betting_lines(
season=2020,
week=2
)
print(json_data)
time.sleep(5)
print("")
# Gets all betting info for Cincinnati Bearcats Football games the 2020 CFB season
print(get_cfbd_betting_lines(season=2020, team="Cincinnati"))
# Gets all betting info for the 2020 CFB season, in the postseason (bowls, playoffs, etc.).
print("Gets all betting info for the 2020 CFB season, in the postseason (bowls, playoffs, etc.).")
json_data = get_cfbd_betting_lines(
season=2020,
season_type="postseason"
)
print(json_data)
time.sleep(5)
print("")
# Gets all betting info for Ohio Bobcats home games the 2020 CFB season
print(get_cfbd_betting_lines(season=2020, home_team="Ohio"))
# Gets all betting info for Cincinnati Bearcats Football games the 2020 CFB season.
print("Gets all betting info for Cincinnati Bearcats Football games the 2020 CFB season.")
json_data = get_cfbd_betting_lines(
season=2020,
team="Cincinnati"
)
print(json_data)
time.sleep(5)
print("")
# Gets all betting info for Ohio State Buckeyes away games the 2020 CFB season
print(get_cfbd_betting_lines(season=2020, away_team="Ohio State"))
# Gets all betting info for Ohio Bobcats home games the 2020 CFB season.
print("Gets all betting info for Ohio Bobcats home games the 2020 CFB season.")
json_data = get_cfbd_betting_lines(
season=2020,
home_team="Ohio"
)
print(json_data)
time.sleep(5)
print("")
# Gets all betting info for Ohio State Buckeyes away games the 2020 CFB season.
print("Gets all betting info for Ohio State Buckeyes away games the 2020 CFB season.")
json_data = get_cfbd_betting_lines(
# Gets all betting info for Ohio State Buckeyes away games the 2020 CFB season
print(get_cfbd_betting_lines(season=2020, away_team="Ohio State"))
time.sleep(5)
print("")
season=2020,
away_team="Ohio State"
)
# Gets all betting info for Atlantic Coast Conference (ACC) games the 2020 CFB season
print(get_cfbd_betting_lines(api_key=cfbd_key, year=2020, conference_abv="ACC"))
# Gets all betting info for Atlantic Coast Conference (ACC) games the 2020 CFB season.
print("Gets all betting info for Atlantic Coast Conference (ACC) games the 2020 CFB season.")
json_data = get_cfbd_betting_lines(
season=2020,
conference_abv="ACC"
)
print(json_data)
time.sleep(5)
print("")
# You can also tell this function to just return the API call as a Dictionary (read: JSON) object.
print(get_cfbd_betting_lines(api_key=cfbd_key, year=2020, return_as_dict=True))
print("You can also tell this function to just return the API call as a Dictionary (read: JSON) object.")
json_data = get_cfbd_betting_lines(
season=2020,
return_as_dict=True
)
print(json_data)
```
Expand Down Expand Up @@ -237,7 +291,7 @@ def get_cfbd_betting_lines(
else:
real_api_key = get_cfbd_api_token(api_key_dir=api_key_dir)

if api_key == "tigersAreAwsome":
if real_api_key == "tigersAreAwsome":
raise ValueError(
"You actually need to change `cfbd_key` to your CFBD API key.")
elif "Bearer " in real_api_key:
Expand Down
Loading

0 comments on commit c6fe119

Please sign in to comment.