Skip to main content

An API wrapper for IGDB API v3

Project description

IGDB Python API V3

A Python wrapper for IGDB.com's Video Game Database API.

IMPORTANT

This wrapper is ONLY compatible with the newest release (V3).

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-v3

Usage

Using your API key

Create a new IGDBWrapper object and give it your API key:

from igdb.wrapper import IGDBWrapper
wrapper = IGDBWrapper("YOUR_API_KEY")

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_request This method handles IGDB generated proto classes which returns an ByteArray to 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

Exceptions

The wrapper throws a requests.HTTPError when an exception occurs from the API.

Code Examples

TBD

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

igdb-api-v3-0.0.2.tar.gz (33.5 kB view details)

Uploaded Source

Built Distribution

igdb_api_v3-0.0.2-py3-none-any.whl (35.1 kB view details)

Uploaded Python 3

File details

Details for the file igdb-api-v3-0.0.2.tar.gz.

File metadata

  • Download URL: igdb-api-v3-0.0.2.tar.gz
  • Upload date:
  • Size: 33.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

File hashes

Hashes for igdb-api-v3-0.0.2.tar.gz
Algorithm Hash digest
SHA256 9ab70d7a8881ecec211ddccea0ef5d8ddef393e648b80df2e3152a829836757d
MD5 cfd8f84d19d6d5970ca50f6c2b08401d
BLAKE2b-256 b93d560fed30ef9845c83d33f0e4365cb009e019e825fac69fe37e1cc288d885

See more details on using hashes here.

File details

Details for the file igdb_api_v3-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: igdb_api_v3-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 35.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

File hashes

Hashes for igdb_api_v3-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3613201b3aea77da52f94e6fc1908697911d86e2d2d82fe757edaecb8dee42cf
MD5 71a953c61080373e843ded4df7e277e8
BLAKE2b-256 c9fe6b1fdd91484eddeeb3d11eed1ba573565271b7f49a83ec8578ad1ecd8c1a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page