XBOX One API
Project description
Description
This is a Python wrapper for the unofficial Xbox API
Installation
For now you will have to install manually, as I didn't upload the initial version to pypi (pip
).
- Clone this repo
- Place the
xboxapi
directory in your project
The only dependency is requests library.
Usage
This is a basic example of how to create a client and fetch a gamers profile information from their gamertag.
from xboxapi import Client
client = Client(api_key=<api_key>)
gamer = client.gamer('voidpirate')
profile = gamer.get('profile')
Client
class constructor takes the following optional arguments except api_key
.
Argument | Value | Short Description |
---|---|---|
api_key | string | api token from Xbox API |
timeout | int | how long until the request times out (seconds) |
lang | string | country language code (e.g. for German (de-DE )) |
Client
class public methods.
Method | Value | Optional | Short Description |
---|---|---|---|
gamer(gamertag=<string>) |
string | xuid=<string> |
gamertag to lookup |
calls_remaining() |
n/a | n/a | Return headers about api rate limits |
A note about the gamer method. If you already know the gamers xuid you can use that instead to avoid an additional api call when using only a gamertag.
Gamer
class public methods, returned from gamer method in Client
.
Method | Value | Optional | Short Description |
---|---|---|---|
get(method=<string>) |
string | term=<string> |
API calls. |
send_message(message=<string>) |
string | n/a | Send a message to gamer |
send_activity(message=<string>) |
string | n/a | Update your activity feed with a message |
Pagination is supported in this client and all handled through get
method. It works by detecting the response header for pagination, any subsequent calls to the same api endpoint will return paged data. If another api call is made to a different endpoint, the pagination token will be cleared and results will not be paged.
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
Built Distribution
File details
Details for the file xboxapi-2.0.1.tar.gz
.
File metadata
- Download URL: xboxapi-2.0.1.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6034a3c67574d2f065f5f9b68291a771e81d337c35fffa57578c5267939378cf |
|
MD5 | 3ba82a9afe2341d04208b3c21ad6e8c7 |
|
BLAKE2b-256 | 6872a5f198e1f9c9f73b2058b25eed965418140ca427d636a2513603b574e934 |
File details
Details for the file xboxapi-2.0.1-py3-none-any.whl
.
File metadata
- Download URL: xboxapi-2.0.1-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04f0e8ff650e0fb9dc3fe921cba86a538170a7a77467f3ca51c422d98d69d758 |
|
MD5 | 8c9443840d03319deecb640bb4649874 |
|
BLAKE2b-256 | 30134990dec608534df315ac1d6ba66fc57cc7a86804966e4bc22ec3e233eb8e |