Full-time developer since 2022
Working daily with JavaScript, HTML, CSS, SQL, Kotlin, Perl & many more..
In love with Python since 2016
Bruce | diskito.eu | siegeapi | Siege skins
My socials and other stuff
Finding beauty in problem solving
Rainbow Six Siege Python API Interface
Home Page: https://cndrd.github.io/siegeapi/
License: MIT License
Full-time developer since 2022
Working daily with JavaScript, HTML, CSS, SQL, Kotlin, Perl & many more..
In love with Python since 2016
Bruce | diskito.eu | siegeapi | Siege skins
My socials and other stuff
Finding beauty in problem solving
Hi, I wanted to ask if this api wrapper is compatible with Playstation and Xbox id's?,
I tried Xbox id with platform=xbl but it doesn't seem to be working..
I have enabled multiple Ubisoft accounts to obtain data on many players. However, in addition to being able to successfully search for players, these accounts now have 429 too many requests for summary and other subsequent steps. It may be that I only use Is it the reason for a normal request request instead of a session conversation?
I have added some very simple features that add new variables and makes the traceback cleaner.
player.py
: load_playtime
a new variable called total_time_played_hours (self explanatory):async def load_playtime(self) -> None:
data = await self._auth.get(self._url_builder.playtime())
stats = data.get("profiles", [])[0].get("stats", {})
self.level = int(stats.get("PClearanceLevel", {}).get("value", 0))
self.pvp_time_played = int(stats.get("PPvPTimePlayed", {}).get("value", 0))
self.pve_time_played = int(stats.get("PPvETimePlayed", {}).get("value", 0))
self.total_time_played = int(stats.get("PTotalTimePlayed", {}).get("value", 0))
self.total_time_played_hours = self.total_time_played // 3600 if self.total_time_played else 0
auth.py
: _find_players
in case of no results, close the connection before raising InvalidRequest
to avoid Unclosed connector
exception in the traceback: (this can be applied to every raise in _find_players
and maybe other methods)async def _find_players(self, name: str, platform: str, uid: str) -> list[Player]:
. . .
. . .
. . .
if "profiles" in data:
results = [Player(self, x) for x in data["profiles"] if x.get("platformType", "") == platform]
if len(results) == 0:
await self.close()
raise InvalidRequest("No results")
return results
else:
raise InvalidRequest(f"Missing key profiles in returned JSON object {str(data)}")
Maybe these are worth or useful, lmk what you think
Thx for your amazing siegeapi! I have checked the commit history, seems like that some work for Y7S4 is ongoing, but I've tried the latest version, Y7S4 stats seems unavailable currently.
File "/home/avien/.local/lib/python3.9/site-packages/siegeapi/auth.py", line 286, in get_player results = await self._find_players(name=name, platform=platform, uid=uid) File "/home/avien/.local/lib/python3.9/site-packages/siegeapi/auth.py", line 77, in _find_players data = await self.get(f"https://public-ubiservices.ubi.com/v3/profiles?" File "/home/avien/.local/lib/python3.9/site-packages/siegeapi/auth.py", line 234, in get raise last_error File "/home/avien/.local/lib/python3.9/site-packages/siegeapi/auth.py", line 225, in get await self.connect() File "/home/avien/.local/lib/python3.9/site-packages/siegeapi/auth.py", line 210, in connect raise FailedToConnect(message) siegeapi.exceptions.FailedToConnect: HTTP 400: The Ubi-AppId header is invalid
I am getting the above error while trying to get user stats
Would it be possible to make a search function instead of using the email and password?
I'll analyze the state of things, and I will try to get a version 4 out as soon as humanly possible lmao
Hoping to get it done by the end of the week tho
I modified the mail, password and uid according to the demo code on the homepage of the repo, but after running the code, I got the following error
Traceback (most recent call last):
File "d:\project\demo\main.py", line 28, in <module>
asyncio.run(sample())
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1776.0_x64__qbz5n2kfra8p0\Lib\asyncio\runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1776.0_x64__qbz5n2kfra8p0\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1776.0_x64__qbz5n2kfra8p0\Lib\asyncio\base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "d:\project\demo\main.py", line 6, in sample
player = await auth.get_player(uid="2ebxxx157")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "d:\project\demo\Lib\site-packages\siegeapi\auth.py", line 288, in get_player
results = await self._find_players(name=name, platform=platform, uid=uid)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "d:\project\demo\Lib\site-packages\siegeapi\auth.py", line 80, in _find_players
data = await self.get(f"https://public-ubiservices.ubi.com/v3/users/{uid}/profiles?"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "d:\project\demo\Lib\site-packages\siegeapi\auth.py", line 236, in get
raise last_error
File "d:\project\demo\Lib\site-packages\siegeapi\auth.py", line 227, in get
await self.connect()
File "d:\project\demo\Lib\site-packages\siegeapi\auth.py", line 212, in connect
raise FailedToConnect(message)
siegeapi.exceptions.FailedToConnect: HTTP 401: Invalid credentials
If I call get_player_batch
with names
param,could it return a dictionary whose key is name
like player[player.name]
? player[player.id] is not easy to use the key for mapping.
Is it possible to get rank information for past seasons using load_ranked_v2()
?
If I can't do it, is there any other way to get it?
(I would like to get rank on Y7S4 and Y8S1.)
Suppose having this function:
async def test():
auth = Auth('email', 'password')
player = await auth.get_player(name='xxx')
ranked = await player.load_ranked()
print(f'max mmr: {ranked.max_mmr}')
# max_mmr: -1
await auth.close()
and the player has played only one ranked game in current season, the value of ranked.max_mmr
is -1
i think that this is not supposed to be -1
but at most 0
because with one single match, the mmr cannot be calculated.
load_all_operators is displayed as load_operators in the docs.
When attempting to get the playtime or level of a console player it returns 0
from siegeapi import Auth
import asyncio
async def sample():
auth = Auth(EMAIL, PASSWORD)
player = await auth.get_player(name="hitchedmuffin17", platform="xbl")
print(f"Name: {player.name}")
print(f"Profile pic URL: {player.profile_pic_url}")
await player.load_persona()
print(f"Streamer nickname: {player.persona.nickname}")
print(f"Nickname enabled: {player.persona.enabled}")
await player.load_playtime()
print(f"Total Time Played: {player.total_time_played:,} seconds / {player.total_time_played_hours:,} hours")
print(f"Level: {player.level}")
await player.load_ranked_v2()
print(f"Ranked Points: {player.ranked_profile.rank_points}")
print(f"Rank: {player.ranked_profile.rank}")
print(f"Max Rank Points: {player.ranked_profile.max_rank_points}")
print(f"Max Rank: {player.ranked_profile.max_rank}")
await player.load_progress()
print(f"XP: {player.xp:,}")
print(f"Total XP: {player.total_xp:,}")
print(f"XP to level up: {player.xp_to_level_up:,}")
await auth.close()
asyncio.run(sample()
returns
Name: HitchedMuffin17
Profile pic URL: https://ubisoft-avatars.akamaized.net/70231a86-716c-4dca-b733-6d8128c0fb83/default_256_256.png
Streamer nickname: None
Nickname enabled: False
Total Time Played: 0 seconds / 0 hours
Level: 0
Ranked Points: 1931
Rank: Bronze 1
Max Rank Points: 1976
Max Rank: Bronze 1
XP: 0
Total XP: 0
XP to level up: 500
Is it possible to search a user using their previous name using this api?
At the moment siegeapi is missing a MMR/Ranked Points endpoint..
I want to add this as soon as possible, but I'm unable to get it to work.
I'm not smart enough to make it work on my own (anything i try to do just spits out a shitload of errors..) and I will have to wait until someone makes a working version for another language so I can take that one apart and try to understand it..
I've even spent a solid few hours trying to go step-by-step, copying what Daniel has done in r6api.js
Too dumb to make that work too..
So until the time comes, when there's a working usable library, siegeapi is fucked ๐ฅ
What is the return of player.total_time_played
?
I don't think is in seconds, so what?
When running the example code (Windows, Python 3.8.12), I get an exception. Here's the final part of it:
C:\usr\Miniconda3\lib\site-packages\siegeapi\player.py in <module>
6 from .url_builder import UrlBuilder
7 from .operators import Operators
----> 8 from .weapons import Weapons
9 from .trends import Trends
10 from .ranks import Rank
C:\usr\Miniconda3\lib\site-packages\siegeapi\weapons.py in <module>
29
30
---> 31 class WeaponsGameMode:
32 def __init__(self, data: dict):
33 self.primary: list = self._get_weapons_list(data.get("weaponSlots", {}).get("primary
Weapons", {}).get("weaponTypes", [{}])[0].get("weapons", []))
C:\usr\Miniconda3\lib\site-packages\siegeapi\weapons.py in WeaponsGameMode()
35
36 @staticmethod
---> 37 def _get_weapons_list(data: List[dict] | None) -> List[Weapon] | None:
38 return None if not data else [Weapon(weapon) for weapon in data]
39
TypeError: unsupported operand type(s) for |: '_GenericAlias' and 'NoneType'
Any thoughts?
Yeah so Ubi, once again, have changed how their shit works
Now this time it's a bit on me, since I missed this one and expected these stats to just hide behind a different endpoint
How silly of me..
Instead of having a per-day / per-week / per-month datapoints we now get per-match "actuals" & "trend"
At least it looks nice when on a chart..
The unions do not work for 3.9. You use Union[str, int]
for 3.9 and below.
I'm somewhat new to the game and the api works fine but when I tried loading general stats everything is 0. I also tried it with a friend and his returns a bunch of info. Is this because it only returns unranked stats and is there a method to return quick match stats?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.