Skip to main content

A library to authenticate with Windows Live/Xbox Live and use their API

Project description

Xbox-WebAPI

Latest Version Documentation Status https://travis-ci.org/OpenXbox/xbox-webapi-python.svg?branch=master Discord chat channel

Xbox-WebAPI is a python library to authenticate with Xbox Live via your Microsoft Account and provides Xbox related Web-API.

Authentication via credentials or tokens is supported, Two-Factor-Authentication ( 2FA ) is also possible.

Dependencies

  • Python >= 3.5

  • Libraries: requests, demjson, appdirs, urwid

How to use

Install:

pip install xbox-webapi

Authentication:

# Token save location: If tokenfile is not provided via cmdline, fallback
# of <appdirs.user_data_dir>/tokens.json is used as save-location
#
# Specifically:
# Windows: C:\\Users\\<username>\\AppData\\Local\\OpenXbox\\xbox
# Mac OSX: /Users/<username>/Library/Application Support/xbox/tokens.json
# Linux: /home/<username>/.local/share/xbox
#
# For more information, see: https://pypi.org/project/appdirs and module: xbox.webapi.scripts.constants

xbox-authenticate --tokens tokens.json --email no@live.com --password abc123

# NOTE: If no credentials are provided via cmdline, they are requested from stdin
xbox-authenticate --tokens tokens.json

# If you have a shell compatible with ncurses, you can use the Terminal UI app
xbox-auth-ui --tokens tokens.json

Fallback Authentication:

# In case this authentication flow breaks or you do not trust the code with your credentials..
# Open the following URL in your web-browser and authenticate
https://login.live.com/oauth20_authorize.srf?display=touch&scope=service%3A%3Auser.auth.xboxlive.com%3A%3AMBI_SSL&redirect_uri=https%3A%2F%2Flogin.live.com%2Foauth20_desktop.srf&locale=en&response_type=token&client_id=0000000048093EE3

# Once you finished auth and reached a blank page, copy the redirect url from your browser address-field
# Execute the script with supplied redirect url
xbox-auth-via-browser 'https://login.live.com/oauth20_desktop.srf?...access_token=...&refresh_token=...'

API usage:

# Search Xbox One Catalog
xbox-searchlive --tokens tokens.json "Some game title"

# Search Xbox 360 Catalog
xbox-searchlive --tokens tokens.json -l "Some game title"

Screenshots

Here you can see the Auth TUI (Text user interface):

https://raw.githubusercontent.com/OpenXbox/xbox-webapi-python/master/assets/xbox_auth_tui_main.png https://raw.githubusercontent.com/OpenXbox/xbox-webapi-python/master/assets/xbox_auth_tui_2fa.png

Known issues

  • There are a lot of missing XBL endpoints

Contribute

  • Report bugs/suggest features

  • Add/update docs

  • Add additional xbox live endpoints

Credits

This package uses parts of Cookiecutter and the audreyr/cookiecutter-pypackage project template. The authentication code is based on joealcorn/xbox

Informations on endpoints gathered from:

Disclaimer

Xbox, Xbox One, Smartglass and Xbox Live are trademarks of Microsoft Corporation. Team OpenXbox is in no way endorsed by or affiliated with Microsoft Corporation, or any associated subsidiaries, logos or trademarks.

History

1.1.4 (2018-07-01)

  • Implement convenience functions for Partner Service Authentication

1.1.3 (2018-06-16)

  • Gracefully fail on wrong account password

  • Fix “ValueError: tui: Unexpected button pressed: Cancel”

  • provider.lists: Correct headers, GET list works

  • Titlehub: Support getting title history by xuid

1.1.2 (2018-05-06)

  • Fixing appdir (aka. token save location) creation on windows

1.1.1 (2018-05-03)

  • Removed python-dateutil dependency

  • Add auth-via-browser fallback script

  • Small changes

1.1.0 (2018-04-17)

  • Auth: Updated 2FA authentication to meet current windows live auth flow

  • Auth: Redesigned 2FA authentication procedure

  • Auth: Implemented xbox-auth-ui script (xbox.webapi.scripts.tui: urwid terminal ui)

  • Auth: For password masking, getpass instead or raw input() is used

  • Scripts: Default to appdirs.user_data_dir if no tokenfile provided via cmdline argument (see README)

1.0.9 (2018-03-30)

  • Extend Gameclips provider with title id filtering and saved clips

  • Add Screenshots provider

  • Add Titlehub provider

1.0.8 (2018-03-29)

  • Added Userstats endpoint

  • Updated README

1.0.7 (2018-03-28)

  • Support supplying auth credentials via stdin

  • Added tests for all endpoints

  • Added tests for authentication

  • Added QCS endpoint

  • Added Profile endpoint

  • Added Achievements endpoint

  • Added Usersearch endpoint

  • Added Gameclips endpoint

  • Added People endpoint

  • Added Presence endpoint

  • Added Message endpoint

  • Removed Gamerpics endpoint

1.0.3 - 1.0.6 (2018-03-17)

  • Metadata changes

1.0.2 (2018-03-17)

  • More metadata changes, rendering on PyPi is fine now

1.0.1 (2018-03-17)

  • Metadata changes

1.0.0 (2018-03-17)

  • First release on PyPI.

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

xbox-webapi-1.1.6.tar.gz (381.6 kB view details)

Uploaded Source

Built Distribution

xbox_webapi-1.1.6-py2.py3-none-any.whl (45.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file xbox-webapi-1.1.6.tar.gz.

File metadata

  • Download URL: xbox-webapi-1.1.6.tar.gz
  • Upload date:
  • Size: 381.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.3

File hashes

Hashes for xbox-webapi-1.1.6.tar.gz
Algorithm Hash digest
SHA256 d5d7b37f42302044f21fcc84b0b69beab414728dbb87e7ee9cd5a082fa13fcb1
MD5 be481f2b380bb0cdf7fef6a594e6886d
BLAKE2b-256 a4de38595a882f734ef9485f5fe91d99028ff01a0d12f42fc03e8196a6b32b64

See more details on using hashes here.

File details

Details for the file xbox_webapi-1.1.6-py2.py3-none-any.whl.

File metadata

  • Download URL: xbox_webapi-1.1.6-py2.py3-none-any.whl
  • Upload date:
  • Size: 45.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.3

File hashes

Hashes for xbox_webapi-1.1.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 338f7fe4f35735dd6fe94ef1436aa130ba175c5d5050d356abdb96d4f16d3761
MD5 e7f88cad0af92cf9a2a0292f9837f3d0
BLAKE2b-256 d6ab6e8995c826a59af60be4e69caea1d9f37e0ca9fd2ed9284be8baaf64eb15

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