IGDB Python API V4
A Python wrapper for IGDB.com's Video Game Database API.
IMPORTANT
This wrapper is ONLY compatible with the newest release (V4).
About IGDB
One of the principles behind IGDB.com is accessibility of data. We wish to share the data with anyone who wants to build cool video game oriented websites, apps and services. This means that the information you contribute to IGDB.com can be used by other projects as well.
Thus, you are not only contributing to the value of this site but to thousands of other projects as well. We are looking forward to see what exciting game related projects you come up with. Happy coding!
More info here:
Information about the Querying language APICalypse:
About the Wrapper
The Wrapper can handle both the IGDB generated classes and JSON (Strings), I have chosen to make the API's Generated classes (Protocol Buffers) the standard way because it will make it easier to use as you don't have to create your own classes to hold the information.
The package contains two modules: the wrapper which holds the tools for querying the API, and igdbapi_pb2 which contains all of the generated classes for the Protocol Buffers.
Installation and Setup
pip install igdb-api-v4
Usage
Using your Twitch Credentials
Create a new IGDBWrapper object and give it your Client-ID and App Access Token:
from igdb.wrapper import IGDBWrapper
wrapper = IGDBWrapper("YOUR_CLIENT_ID", "YOUR_APP_ACCESS_TOKEN")
How to use the wrapper
Right now, the wrapper is very barebone and only has one wrapping function api_request, which queries the API when given an endpoint and an APICalypse-like query and returns a byte array with the results.
More utilities will be added in the future, such as endpoint helper functions, JSON conversion, and Protobuf message parsing.
api_requestThis method handles IGDB generated proto classes which returns anByteArrayto be used to fill the appropriate class.
'''With a wrapper instance already created'''
# JSON API request
byte_array = wrapper.api_request(
'games',
'fields id, name; offset 0; where platforms=48;'
)
# parse into JSON however you like...
# Protobuf API request
from igdb.igdbapi_pb2 import GameResult
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
games = games_message.games
Exceptions
The wrapper throws a requests.HTTPError when an exception occurs from the API.
Code Examples
Contributing / Developers
Setup
Python
This project uses Python 3.7+ and pipenv to manage dependencies.
pip install --user pipenv
pipenv install --dev
Protocol Buffers
If you want to update the library to use the latest Protobuf file from api.igdb.com you can run ./update-protobuf.sh
Windows
This project uses protoc to generate the protocol buffer wrapper.
set PB_REL="https://github.com/protocolbuffers/protobuf/releases"
set PB_VERSION=3.13.0
set PB_OS=win
set PB_ARCH=64
curl -LO %PB_REL%/download/v%PB_VERSION%/protoc-%PB_VERSION%-%PB_OS%%PB_ARCH%.zip
Unzip to a protoc folder.
cd protoc-3.13.0-win64\bin
protoc.exe -I=../../src/igdb --python_out=../../src/igdb igdbapi.proto
Mac
Then run protoc:
protoc -I=. --python_out=. igdbapi.proto
Metadata
Release files for igdb-api-v4 0.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| igdb-api-v4-0.3.3.tar.gz | 15.2 kB | Without provenance | Details for igdb-api-v4-0.3.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| igdb_api_v4-0.3.3-py3-none-any.whl | Python 3 | none | any | Details for igdb_api_v4-0.3.3-py3-none-any.whl |
Total release size: 30.9 kB
Release files / igdb-api-v4-0.3.3.tar.gz
| Download URL | igdb-api-v4-0.3.3.tar.gz |
|---|---|
| Size | 15.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
25de6ba3f7641d0bf0f88d034e6d38e1327375535aa7c01c1d9572069ed01ea5
|
|
BLAKE2b-256 checksum How to use checksums |
61c0a9f7cf5171d81668a6940be5b811c9902bd9144257f8ffb3fbd15eebc3e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.14
|
Release files / igdb_api_v4-0.3.3-py3-none-any.whl
| Download URL | igdb_api_v4-0.3.3-py3-none-any.whl |
|---|---|
| Size | 15.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7b878d3e6cf01da5d73761432a52b699467b75ae858c7d6c6f7cfce241818e0e
|
|
BLAKE2b-256 checksum How to use checksums |
aab86e6bc134fb7fb7b1c40fed2606c345ad88455bac8ea5cce682712ff10e9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.14
|
Security for igdb-api-v4 0.3.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.