Skip to main content

mod.io python wrapper

Project description

mod.io

mod.io Logo License: MIT

A wrapper for the mod.io API in Python.

Basic Examples

import modio

client = modio.Client(api_key="your api key here", access_token="your o auth 2 token here")

game = client.get_game(345)
#gets the game with id 345

print(game.name)
#prints the name of the game

mod = game.get_mod(231)
#gets the mod for that game with id 231

How to install

pip install mod.io

Getting an OAuth 2 Access Token

To perform writes, you will need to authenticate your users via OAuth 2. To make this easy this library provides you with two functions to use in order to obtain your Access Token. You will need an API Key and an email adress to which you have access in order for this to work. Once you have both, follow the example below, you can either run this in a REPL or as a Python script. Don't forget to edit the script to add your own api key and email adress.

Example

import modio

client = modio.Client(api_key="your api key here")

#request a security code be sent at this email adress
client.email_request("necro@mordor.com")

#check your email for the security code
code = input("Code: ")

oauth2 = client.email_exchange(code)

#your oauth2 token is now stored in the variable

#to save into a file simply
with open("oauth2.txt", "w") as file:
    file.write(oauth2)

#and now the token is stored in oauth2.txt

Unsupported Endpoints

Most /external/ endpoints are unsupported as they are intended to be integrated directly into games which isn't the scope of this wrapper. This wrapper is mainly for reading the site although it does have some support for editing and adding new stuff.

This also means that the Platform and Portal endpoints/headers are unsupported.

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

mod.io-0.6.0.tar.gz (36.0 kB view details)

Uploaded Source

Built Distribution

mod.io-0.6.0-py3-none-any.whl (36.0 kB view details)

Uploaded Python 3

File details

Details for the file mod.io-0.6.0.tar.gz.

File metadata

  • Download URL: mod.io-0.6.0.tar.gz
  • Upload date:
  • Size: 36.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for mod.io-0.6.0.tar.gz
Algorithm Hash digest
SHA256 dac77ac2d0fe736c6c6936b3149c813f54b31161a62312ee073af052a248f51a
MD5 7b08816bef1bf88294d7d22fd7961dba
BLAKE2b-256 de69f13a89a092f7dfa19111a22196edb4b0852a21a88c1818c3da9e5e9c08ae

See more details on using hashes here.

File details

Details for the file mod.io-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: mod.io-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 36.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for mod.io-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 64aef6c4b75ecc7726491d7603954f2ea8244996fa8c7ec799b8e273aedb66a9
MD5 c1af176cc6da3b3d7e89486a341c3e88
BLAKE2b-256 b492b106c7f2c3e3ba161608a297163c405565784c522f9ac5312f23d2fb0058

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