jrey999 / mlb-positive-ev

find positive EV bets using the odds API
5 stars 1 forks source link

odds.py - TypeError: string indices must be integers #1

Closed hanikhatib closed 11 months ago

hanikhatib commented 11 months ago

When I reach the command: python odds.py

I get the following error:

Traceback (most recent call last): File "/Users/mlb-positive-ev/odds.py", line 8, in game = Game(game) File "/Users/mlb-positive-ev/odds/datamodels.py", line 10, in init self.data = game_and_odds["bookmakers"] TypeError: string indices must be integers

Have you ran into this before? If so, any help here would be much appreciated. Working off a Macbook M1. Thanks.

jrey999 commented 11 months ago

double check that you created an API KEY from https://the-odds-api.com/

and that you created a .env file that has API_KEY=###your API Key Here###

That error is likely because when a request was made to the odds-api, it wasn't authenticated with an API key, so instead of returning data it returned {'message': 'API key is missing'}

hanikhatib commented 11 months ago

Thanks for the quick response. I re-cloned the repo and made sure the API key was authenticated. it works now! Thanks

jrey999 commented 11 months ago

Glad to hear