Library written in Python that wraps Halo Infinite API.

Overview

haloinfinite

Library written in Python that wraps Halo Infinite API.

Before start

It's unofficial, reverse-engineered, neither stable nor production ready Halo Infinite web API.

You need to register an Azure Active Directory application and set a Client Secret for your application.

Credits

Credits to Den Delimarsky for the reverse-engineering. If you want to learn more then check his Halo Infinite Web API blog series. Also you can use his API wrapper written in C#.

Installing

From Pip (recommended)

pip install haloinfinite

From Github

pip install git+https://github.com/ingmferrer/haloinfinite.git

From tar.gz file

Download haloinfinite-X.Y.Z.tar.gz from the Releases page.

pip install haloinfinite-X.Y.Z.tar.gz

Usage

Client instantiation

from haloinfinite.client import HaloInfiniteAPIClient as Client
client = Client(client_id, client_secret, user_token=None, xbox_user_token=None, xsts_xbox_token=None, xsts_halo_token=None, spartan_token=None, clearance_token=None)

OAuth 2.0

Get authorization url

url = client.get_authorization_url(redirect_uri, scope=["Xboxlive.signin", "Xboxlive.offline_access"], state=None)

Exchange the code for an user token

user_token = client.exchange_code(redirect_uri, code)

# print(user_token.data)
{
    "token_type": "bearer",
    "expires_in": 3600,
    "scope": "XboxLive.signin XboxLive.offline_access",
    "access_token": "...",
    "refresh_token": "...",
    "user_id": "...",
}

Refresh user token

user_token = client.refresh_token(redirect_uri, user_token["refresh_token"])

# print(user_token.data)
{
    "token_type": "bearer",
    "expires_in": 3600,
    "scope": "XboxLive.signin XboxLive.offline_access",
    "access_token": "...",
    "refresh_token": "...",
    "user_id": "...",
}

Set user token

client.set_user_token(user_token)

Get xbox user token

xbox_user_token = client.get_xbox_user_token()

# print(xbox_user_token.data)
{
    "IssueInstant": "2022-02-06T01:00:03.6132203Z",
    "NotAfter": "2022-02-20T01:00:03.6132203Z",
    "Token": "...",
    "DisplayClaims": {"xui": [{"uhs": "..."}]},
}

Set xbox user token

client.set_xbox_user_token(token=xbox_user_token)

Get xsts xbox token

xsts_xbox_token = client.get_xsts_xbox_token()

# print(xsts_xbox_token.data)
{
    "IssueInstant": "2022-02-06T01:35:40.7628209Z",
    "NotAfter": "2022-02-06T17:35:40.7628209Z",
    "Token": "...",
    "DisplayClaims": {
        "xui": [
            {
                "gtg": "...",
                "xid": "...",
                "uhs": "...",
                "agg": "Adult",
                "usr": "...",
                "utr": "...",
                "prv": "...",
            }
        ]
    },
}

Set xsts xbox token

client.set_xsts_xbox_token(token=xsts_xbox_token)

Get xsts halo token

xsts_halo_token = client.get_xsts_xbox_token()

# print(xsts_halo_token.data)
{
    "IssueInstant": "2022-02-06T01:12:27.9108457Z",
    "NotAfter": "2022-02-06T05:12:27.9108457Z",
    "Token": "...",
    "DisplayClaims": {"xui": [{"uhs": "..."}]},
}

Set xsts halo token

client.set_xsts_halo_token(token=xsts_halo_token)

Get spartan token

spartan_token = client.get_xsts_xbox_token()

# print(spartan_token.data)
{
    "SpartanToken": "...",
    "ExpiresUtc": {"ISO8601Date": "2022-02-06T05:12:27Z"},
    "TokenDuration": "PT3H34M12.4226916S",
}

Set spartan token

client.set_spartan_token(token=spartan_token)

Get clearance token

clearance_token = client.get_clearance_token()

# print(clearance_token.data)
{
    "FlightConfigurationId": "...",
}

Set clearance token

client.set_clearance_token(token=clearance_id)

Match API

Match privacy

response = client.match.get_match_privacy()

# print(response.data)
{'MatchmadeGames': 1, 'OtherGames': 2}

Match count

response = client.match.get_match_count()

# print(response.data)
{'CustomMatchesPlayedCount': 6, 'MatchesPlayedCount': 885, 'MatchmadeMatchesPlayedCount': 879, 'LocalMatchesPlayedCount': 0}

Match history

response = client.match.get_match_history()

# print(response.data)
{'Count': 25,
 'Links': {},
 'ResultCount': 25,
 'Results': [{'LastTeamId': 0,
              'MatchId': '...',
              'MatchInfo': {'ClearanceId': '...',
                            'Duration': 'PT9M22.8961519S',
                            'EndTime': '2022-02-05T23:30:32.564Z',
                            'GameVariantCategory': 9,
                            'LevelId': '...',
                            'LifecycleMode': 3,
                            'MapVariant': {'AssetId': '...',
                                           'AssetKind': 2,
                                           'VersionId': '...'},
                            'PlayableDuration': 'PT9M22.875S',
                            'Playlist': {'AssetId': '...',
                                         'AssetKind': 3,
                                         'VersionId': '...'},
                            'PlaylistExperience': 5,
                            'PlaylistMapModePair': {'AssetId': '...',
                                                    'AssetKind': 7,
                                                    'VersionId': '...'},
                            'SeasonId': 'Seasons/Season6.json',
                            'StartTime': '2022-02-05T23:20:39.923Z',
                            'TeamScoringEnabled': True,
                            'TeamsEnabled': True,
                            'UgcGameVariant': {'AssetId': '...',
                                               'AssetKind': 6,
                                               'VersionId': '...'}},
              'Outcome': 3,
              'PresentAtEndOfMatch': True,
              'Rank': 6},
              ...
 'Start': 0}

Match stats

response = client.match.get_match_stats(match_id)

# print(response.data)
{'MatchId': '...',
 'MatchInfo': {'ClearanceId': '...',
               'Duration': 'PT9M22.8961519S',
               'EndTime': '2022-02-05T23:30:32.564Z',
               'GameVariantCategory': 9,
               'LevelId': '...',
               'LifecycleMode': 3,
               'MapVariant': {'AssetId': '...',
                              'AssetKind': 2,
                              'VersionId': '...'},
               'PlayableDuration': 'PT9M22.875S',
               'Playlist': {'AssetId': '...',
                            'AssetKind': 3,
                            'VersionId': '...'},
               'PlaylistExperience': 5,
               'PlaylistMapModePair': {'AssetId': '...',
                                       'AssetKind': 7,
                                       'VersionId': '...'},
               'SeasonId': 'Seasons/Season6.json',
               'StartTime': '2022-02-05T23:20:39.923Z',
               'TeamScoringEnabled': True,
               'TeamsEnabled': True,
               'UgcGameVariant': {'AssetId': '...',
                                  'AssetKind': 6,
                                  'VersionId': '...'}},
 'Players': [...],
 'Teams': [...],

Match skill

response = client.match.get_match_skill(match_id, player_id)

# print(response.data)
{'Value': [{'Id': 'xuid(...)',
            'Result': {'Counterfactuals': {'SelfCounterfactuals': {'Deaths': 12.38441050555862,
                                                                   'Kills': 11.805217023995946},
                                           'TierCounterfactuals': {}},
                       'RankRecap': {'PostMatchCsr': {'InitialMeasurementMatches': 0,
                                                      'MeasurementMatchesRemaining': 0,
                                                      'NextSubTier': 0,
                                                      'NextTier': '',
                                                      'NextTierStart': 0,
                                                      'SubTier': 0,
                                                      'Tier': '',
                                                      'TierStart': 0,
                                                      'Value': 0},
                                     'PreMatchCsr': {'InitialMeasurementMatches': 0,
                                                     'MeasurementMatchesRemaining': 0,
                                                     'NextSubTier': 0,
                                                     'NextTier': '',
                                                     'NextTierStart': 0,
                                                     'SubTier': 0,
                                                     'Tier': '',
                                                     'TierStart': 0,
                                                     'Value': 0}},
                       'RankedRewards': None,
                       'StatPerformances': {'Deaths': {'Count': 9,
                                                       'Expected': 12.38441050555862,
                                                       'StdDev': 4.498181792537211},
                                            'Kills': {'Count': 13,
                                                      'Expected': 11.805217023995946,
                                                      'StdDev': 4.750282423640629}},
                       'TeamId': 0,
                       'TeamMmr': 1149.370133486992,
                       'TeamMmrs': {'0': 1149.370133486992,
                                    '1': 1151.942592441846}},
            'ResultCode': 0}]}

Match progression

response = client.match.get_match_progression(match_id)

# print(response.data)
{'ChallengeProgressState': [{'Id': '...',
                             'Path': 'ChallengeContent/ClientChallengeDefinitions/S1CapstoneChallenges/CSamuraiMedalKilljoy.json',
                             'PreviousProgress': 1,
                             'Progress': 3},
                            {'Id': '...',
                             'Path': 'ChallengeContent/ClientChallengeDefinitions/DailyChallenges/PlayNew/d0NPlayB1.json',
                             'PreviousProgress': 0,
                             'Progress': 1}],
 'ClearanceId': '...',
 'RewardId': '...'}

Requirements

  • requests
  • python-dateutil

Tests

  • Not yet

Contributing

We are always grateful for any kind of contribution including but not limited to bug reports, code enhancements, bug fixes, and even functionality suggestions.

You can report any bug you find or suggest new functionality with a new issue.

If you want to add yourself some functionality to the wrapper:

  1. Fork it ( https://github.com/ingmferrer/haloinfinite )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Adds my new feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request
You might also like...
Clubhouse API written in Python. Standalone client included. For reference and education purposes only.
Clubhouse API written in Python. Standalone client included. For reference and education purposes only.

clubhouse-py is originally developed for the sake of interoperability. Standalone client is also created with very basic features, including but not limited to the audio-chat

A GETTR API client written in Python.

GUTTR A GETTR client library written in Python. I rushed to get this out so it's a bit janky. Open an issue if something is broken or missing. Getting

The official wrapper for spyse.com API, written in Python, aimed to help developers build their integrations with Spyse.

Python wrapper for Spyse API The official wrapper for spyse.com API, written in Python, aimed to help developers build their integrations with Spyse.

An API wrapper for convertio.co written in Python.

An API wrapper for convertio.co written in Python.

A simple API wrapper for Discord written in Python.

AIOCord This project is work in progress not for production use A simple asynchronous API wrapper around Discord API written in Python. Inspiration Th

A tool written in Python used to instalock agents in VALORANT using the local API.

Valorant Instalock Tool v2.1.0 by Mr. SOSA A tool written in Python used to instalock agents in VALORANT using the local API. This is NOT a hotkey pro

Python written Rule34 API

Python written Rule34 API

A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python.
A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python.

A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python. Key Features Modern Pythonic API using async and await

A modern,feature-rich, and async ready API wrapper for Discord written in Python

discord.io A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python. Key Features Modern Pythonic API using asyn

Owner
Miguel Ferrer
Creador de teemu.app y discordea.net
Miguel Ferrer
The elegance of Airflow + the power of AWS

Orkestra The elegance of Airflow + the power of AWS

Stephan Fitzpatrick 42 Nov 01, 2022
SpamSMS - SPAM SMS menggunakan api web INDIHOME

SPAM SMS Unlimited SPAM SMS menggunakan api web INDIHOME Cara Install Di Termux

Zuck-Ker 1 Jan 08, 2022
Repository to access information of stocks in Bombay Stock Exchange.

BSE Repository to access information of stocks in Bombay Stock Exchange. The code in this repository uses BSE API and conclusions made using the code

1 Nov 13, 2021
An Advanced Telegram Bot to Play Radio & Music in Voice Chat. This is Also The Source Code of The Bot Which is Being Used For Playing Radio in @AsmSafone Channel ❤️

Telegram Radio Player V3 An Advanced Telegram Bot to Play Nonstop Radio/Music/YouTube Live in Channel or Group Voice Chats. This is also the source co

SAF ONE 421 Jan 05, 2023
Forked from 0x36 on github who then rewrote the ida_kernelcache python framework

Forked from 0x36 on github who then rewrote the ida_kernelcache python framework. Sadly 0x36 doesn't seem to have push updates to the project and it took me a very long time to figure out why this wa

Turnerhackz1 6 Dec 13, 2022
simple discord token grabber with webhook hiding feature.

Token Grabber A simple Discord token grabber with base64 webhook encoding, it uses pastebin as a database to get webhook, so next time u dont get your

0 Dec 01, 2021
Implement backup and recovery with AWS Backup across your AWS Organizations using a CI/CD pipeline (AWS CodePipeline).

Backup and Recovery with AWS Backup This repository provides you with a management and deployment solution for implementing Backup and Recovery with A

AWS Samples 8 Nov 22, 2022
Estudo de como criar uma api para o gerenciamento de livros usando a django restframework

Boa parte do projeto foi beaseado nesse vídeo e nesse artigo. Se assim como eu, você entrou agora no mundo BackEnd, recomendo fortemente tais materiai

Michel Ledig 14 Jun 28, 2022
A Telegram Music Bot with proper functions written in Python with Pyrogram and Py-Tgcalls.

⭐️ Yukki Music Bot ⭐️ A Telegram Music Bot written in Python using Pyrogram and Py-Tgcalls Ready to use method A Support Group and ready-to-use runnin

Shikhar Kumar 1000 Jan 03, 2023
A self hosted slack bot to conduct standups & generate reports.

StandupMonkey A self hosted slack bot to conduct standups & generate reports. Report Bug · Request Feature Installation Install already hosted bot (Us

Muhammad Haseeb 69 Jan 01, 2023
Asynchronous multi-platform robot framework written in Python

NoneBot ✨ 跨平台 Python 异步机器人框架 ✨ 文档 · 安装 · 开始使用 · 文档打不开? 简介 NoneBot2 是一个现代、跨平台、可扩展的 Python 聊天机器人框架,它基于 Python 的类型注解和异步特性,能够为你的需求实现提供便捷灵活的支持。

NoneBot 3.1k Jan 04, 2023
Easy to use API Wrapper for somerandomapi.ml.

Overview somerandomapi is an API Wrapper for some-random-api.ml Examples Asynchronous from somerandomapi import Animal import asyncio async def main

Myxi 1 Dec 31, 2021
A Git Alert Bot - Github Integration for Pyrogram & Telethon

Yet Another GitAlertBot Inspired From @Pokurt's GitGram Run Bot: Local Host Git Clone Repo : For Telethon Version : git clone https://github.com/DevsE

DevsExpo 23 Oct 21, 2022
The Simple Google Colab Notebook to Download Files from Direct Link to Google Drive with custom name and bulk link support.

Direct Link to Google Drive (Advanced! 🔥 ) The Most Advanced yet Simple Google Colab Notebook to Download Files from Direct Link to Google Drive. 🆕

Dr.Caduceus 14 Jul 26, 2022
A Python wrapper for discord slash-commands, designed to extend discord.py.

dislash.py An extending library for discord.py that allows to build awesome slash-commands. ⭐

173 Dec 19, 2022
The Github repository for the Amari API wrapper.

Amari.py Amari.py is an async, easy to use API wrapper for the AmariBot. Installation Enter any of these commands to install the library: pip install

TheF1ng3r 5 Dec 19, 2022
TORNADO CASH Pancakeswap Sniper BOT 2022-V1 (MAC WINDOWS ANDROID LINUX)

TORNADO CASH Pancakeswap Sniper BOT 2022-V1 (MAC WINDOWS ANDROID LINUX)

Crypto Trader 1 Jan 06, 2022
A Script to automate fowarding all new messages from one/many channel(s) to another channel(s), without the forwarded tag.

Channel Auto Message Forward A script to automate fowarding all new messages from one/many channel(s) to another channel(s), without the forwarded tag

16 Oct 21, 2022
Kakatua discord music bot

Donate Ayo donasi! Lokal Internasional Ucapan Terima Kasih Tentu saja, donatur Bunga dan talent-talent h!mawari. Semoga rezeki teman-teman semakin lan

1 Oct 30, 2021
A Discord Bot created using Pycord!

Hey, I am Slash Bot. A Bot which works with Slash Commands! Prerequisites Python 3+ Check out. the requirements.txt and install all the pakages. Insta

Saumya Patel 1 Nov 29, 2021