twitchtv / igdb-api-python

Python wrapper for IGDB API version 4
MIT License
75 stars 9 forks source link

Error 403 #9

Closed samuelr357 closed 3 years ago

samuelr357 commented 3 years ago

I am running the example written on the REDME using the code below and I get the error message.

################################################### from igdb.wrapper import IGDBWrapper from igdb.igdbapi_pb2 import GameResult import requests import json wrapper = IGDBWrapper("my ID", "MY PASS" )

'''With a wrapper instance already created'''

JSON API request

byt = wrapper.api_request("games", 'fields id, name; offset 0; where platforms=48;')

parse into JSON however you like...

Protobuf API request

byte_array = wrapper.api_request( 'games.pb', # Note the '.pb' suffix at the endpoint 'fields id, name; offset 0; where platforms=48;' ) games_message = GameResult() games_message.ParseFromString(byte_array) # Fills the protobuf message object with the response #################################################################

and I get the message

Traceback (most recent call last): File "api.py", line 9, in byt = wrapper.api_request("games", File "/home/samuel/.local/lib/python3.8/site-packages/igdb/wrapper.py", line 20, in api_request response.raise_for_status() File "/usr/lib/python3/dist-packages/requests/models.py", line 941, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.igdb.com/v4/games

felixnorden commented 3 years ago

Hi @samuelr357, the 403 hints on the wrapper not gaining access to the API. One potential cause could be the API-key not being valid. Have you verified that it works?

dustyjewett commented 3 years ago

Closing on the assumption that this was a standard authorization error. If you'd like more interactive help, visit us on discord.