billy-yoyo / rainbowsixsiege-python-api Goto Github PK
View Code? Open in Web Editor NEWAsynchronous python api for rainbow six siege (r6sapi)
License: MIT License
Asynchronous python api for rainbow six siege (r6sapi)
License: MIT License
I'm new to the whole siege api thing so I'm not sure what the limitations are but is there anyway to collect Map stats? Like how often a site is selected in ranked/unranked. For example we all know on a map like bank where Open Area is the least favorable site compared to Basement, I was wondering if there was a way to get a number for it to express a percentage. I don't know if ubisoft has a number or not it would just be cool to know, thanks!
I've been using this API to a discord hobby project and everything have been working awesome (so thanks for that!) with the exception that every time I try to find the 'statistic'-value for an operator it always returns 0. All other attributes return the expected value.
Hello,
Getting statistics for Ela doesn't seem to work, is there any chance that this script could be updated to support her?
Thanks!
For the biggest part this API works very well, thanks!
But I noticed many false values during my first few test runs.
I mainly tested with Smoke's values which were all over the place, his XP are those of Melusi, DBNOs are those of Maverick ...
Could this be a problem on my end as I e.g. haven't yet unlocked Melusi in the actual game?
If you could get in touch with me, I would love to learn how you gathered all the information for this API and maybe improve it.
Is there any way to get the K/D from the current / past seasons?
Sure there is the total K/D over all season, but the current K/D would be more useful.
Hello,
im using your API for about half a year now.
Today i wanted to update to 0.8 to get the new operator stats (Clash and Mav).
I noticed that i didin't got any data for those two.
Could you please have a look at method => load_all_operators()
There is a for-loop => for operator in OperatorStatistics:
I don't see the two operators in OperatorStatistics list but i do see them in OperatorStatisticNames list.
So i changed the for-loop and now i got all data.
Could you please check if there is a fault in the script or maybe a fault on my understanding?!
Best regards
CRSLEE
There appears to be a case where r6 bot fails to find a user when messaged via channel, but via direct message the query is successful.
E.g.: Bodybag.Bees
(uplay or xbox).
Trying to push a Discord bot I made using the r6sapi
to Heroku and I get an error saying r6sapi
uses an older version of aiohttp
(<3.0.0, >=2.3.3) which discord.py
cannot use. Trouble is that on my PC when I run the bot myself, it works fine, then when I put it on a server it stops working. If I downgrade versions of discord.py
and r6sapi
to match aiohttp
versions, all my code needs to be re-written because discord.py
went through some massive changes in v1.0.0. Any suggestions would be great.
using the library i noticed that caveira's dictionary in load_all_operators is always zero in all statistics
this is the dictionary:
{ 'dbnos': 0,
'deaths': 0,
'headshots': 0,
'kills': 0,
'losses': 0,
'melees': 0,
'name': 'caveira',
'statistic': 0,
'statistic_name': 'Interrogations',
'time_played': 0,
'wins': 0,
'xp': 0 }
如题,查的次数一多就这样了,有什么好的规避方法吗?
r6sapi.exceptions.InvalidRequest: HTTP 403: The Service: RendezVous, is not currently available for Application 39baebad-39e5-4552-8c25-2c9b919064e2 on the Gateway.
Is there a way that I could maintain a logged in status, maybe through an access token or something similar to prevent the api from blocking multiple calls?
I'm trying to run some tests on a script and I get blocked after a short period, presumably from logging in too many times.
Thanks in advance,
Tom
I try to get the assault_rifle data, but all is 0. And I can get other weapon's data.
Like this:
'''
uplay_id luminous1111
name ASSAULT_RIFLE
weapon_type 0
kills 0
headshots 0
hits 0
shots 0
'''
'''
uplay_id luminous1111
name HANDGUN
weapon_type 4
kills 141
headshots 51
hits 941
shots 1400
'''
And I think some operators' data also have mistake.
For example:
'''
uplay_id luminous1111
name smoke
wins 1
losses 7
kills 66
deaths 52
'''
Why wins+losses < deaths ?
I find two S.A.S def operator(smoke and mute) data have mistake obviosly.
I use examples/player_batch_full_example.py, and I also get these incorrect data.
The list of operators is out of date. Anyway to update them?
Whenever I use player.get_rank() and I specify a season number for something different than -1, I get an error:
File "C:\Program Files\Python37\lib\site-packages\r6sapi\auth.py", line 271, in get
raise InvalidRequest("HTTP %s: %s" % (data["httpCode"], msg), code=data["httpCode"])
r6sapi.exceptions.InvalidRequest: HTTP 500: Uncaught exception
Hopefully someone can provide some insight as to what's going on!
Traceback (most recent call last):
File "C:\Users\Matthew\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 50, in wrapped
ret = yield from coro(*args, **kwargs)
File "C:\Users\Matthew\Desktop\Projects\Python\Discord\Bots\Series\Laugh (All in one)\CogStats.py", line 66, in r6
player = await auth.get_player(user, api.Platforms.UPLAY)
File "C:\Users\Matthew\AppData\Local\Programs\Python\Python36-32\lib\site-packages\r6sapi\r6sapi.py", line 522, in get_player
results = yield from self.get_players(name=name, platform=platform, uid=uid)
File "C:\Users\Matthew\AppData\Local\Programs\Python\Python36-32\lib\site-packages\r6sapi\r6sapi.py", line 488, in get_players
data = yield from self.get("https://public-ubiservices.ubi.com/v2/profiles?nameOnPlatform=%s&platformType=%s" % (parse.quote(name), parse.quote(platform)))
File "C:\Users\Matthew\AppData\Local\Programs\Python\Python36-32\lib\site-packages\r6sapi\r6sapi.py", line 394, in get
raise FailedToConnect
r6sapi.r6sapi.FailedToConnect
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Matthew\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\bot.py", line 846, in process_commands
yield from command.invoke(ctx)
File "C:\Users\Matthew\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 374, in invoke
yield from injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Matthew\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 54, in wrapped
raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: FailedToConnect:
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x06962970>```
I get this error when i run my command? any idea on whats wrong and how to fix?
If you attempt to login with invalid credentials you're given a standard "FailedToConnect" error with no useful information. It'd be nicer if it would try and be more intelligent in its error reporting.
When calling https://connect.ubi.com/ubiservices/v2/profiles/sessions
, I seem to always get 404. I think Ubisoft has deprecated this endpoint and is now using another one.
There is a red discord bot cog which uses your api, with success for quite some time now.
However, since the 3rd of november 2018, we get errors when we issue a request. It seems like public-ubiservices.ubi.com is dead, and the links should be updated accordingly. I can't do this as I have no idea where the new api is, or maybe it is a temporary issue, but it is strange that is is consistently happening for over a month now. isitdownrightnow reports that it is down for them as well and in my browser I can't connect as well. Is there anything we or you can do about this?
See #14 for details about how to get the new ops working.
There'll also be some changes required to the rank levels (images & names), these can be found in https://github.com/billy-yoyo/RainbowSixSiege-Python-API/blob/master/r6sapi/ranks.py
I call Auth.connect() return error
"Attempt to decode JSON with unexpected mimetype: text/html"
cause I can't use other function
What is the complete URL? I only need the Server, then i can add it before every url "get_operator_badge" returns
For me, the readthedocs.com documentation is only showing headlines but nothing beneath. Looking into the rst file, it seems like the text is missing there too?
NOTE: This issue is for when the new season gets released, for now this work doesn't need to be done since the changes are still in TTS.
I'm away for all of September, so won't be able to update the API to the latest season until October.
If anyone wants to do it themselves whilst I'm away, the following needs to be updated:
The url "https://ubistatic-a.akamaihd.net/0058/prod/assets/data/operators.3a2655c8.json" in get_operator_definitions. The number (3a2655c8) will need to be updated with whatever the latest version of this is. This can be found by logging in to the official rainbow statistics website and checking your network log for this file.
Two entries will need to be added to the OperatorStatisticNames dictionary (e.g. "CLASH": "enemies tazed"). It's not always clear what these statistic names are, you can just guess for now then fix it later if it's obviously wrong.
If anyone makes a PR with these changes, I have some access to internet during September so I should be able to merge it, otherwise I'll just do it when I get back.
Either way, pypi package won't be updated until I get back.
The new operator link in get_operator_defenitions() appears to be https://game-rainbow6.ubi.com/assets/data/operators.24b865895.json The only problem is ubi forgot to add the UniqueStatistic for Nomad and Kaid (they are there for Mozzie and Gridlock tho).
So unfortunatly the API throws an keyerror in get_operator_statistic() on the return.
My current workaround (not the most beautifull coding)
after these lines of code in get_operator_definitions():
resp = yield from self.session.get("https://game-rainbow6.ubi.com/assets/data/operators.bbbf29a090.json")
data = yield from resp.json()
I added:
resp_y4 = yield from self.session.get("https://game-rainbow6.ubi.com/assets/data/operators.24b865895.json")
data_y4 = yield from resp_y4.json()
data["mozzie"] = data_y4["mozzie"]
data["gridlock"] = data_y4["gridlock"]
and in OperatorStatisticNames{} I added"
"MOZZIE": "Drones Hacked", "GRIDLOCK": "Trax Deployed"
could we get another upgrade of aiohttp version? For context I'm using this library with a discordpy chat bot, which requires aiohttp>=3.6.0,
currently this project is using aiohttp>=2.3.3,<3.0.0, so I was just wondering if there is a reason we haven't upgraded yet.
I've looked in to this in the past, but couldn't find anything at the time. I think it's worth having another shot at it, since it would prevent the package having to be updated for every operation.
Currently the Auth object creates a client session and will use it forever, without ever closing it
This issue should address both this and the fact that client sessions can go stale. Auth should preferably discard sessions when they go stale, or just periodically. Also there should be some way of more cleanly closing the auth session so you don't get annoying unclosed client session warnings.
Hi, I am having a hard time fetching the Rank object.
##############################################################################
import asyncio
import r6sapi as api
operatorName="valkyrie"
def info():
auth = api.Auth("[email protected]", "mypassword")
player = yield from auth.get_player("NG-Bullseye", api.Platforms.UPLAY)
rank = yield from player.load_rank("EU")
print( "Player Skill: "+str(rank))
asyncio.get_event_loop().run_until_complete(info())
##############################################################################
ERROR MESSAGE:
C:\Users\leona\AppData\Local\Programs\Python\Python36\python.exe C:/Users/leona/OneDrive/Programmieren/Python/PycharmProjects/Telegram-Bot-master/R6Info.py
Traceback (most recent call last):
File "C:/Users/leona/OneDrive/Programmieren/Python/PycharmProjects/Telegram-Bot-master/R6Info.py", line 14, in
asyncio.get_event_loop().run_until_complete(info())
File "C:\Users\leona\AppData\Local\Programs\Python\Python36\lib\asyncio\base_events.py", line 468, in run_until_complete
return future.result()
File "C:/Users/leona/OneDrive/Programmieren/Python/PycharmProjects/Telegram-Bot-master/R6Info.py", line 9, in info
rank = yield from player.load_rank("EU")
File "C:\Users\leona\AppData\Local\Programs\Python\Python36\lib\site-packages\r6sapi\r6sapi.py", line 1104, in load_rank
data = yield from self.auth.get("https://public-ubiservices.ubi.com/v1/spaces/%s/sandboxes/%s/r6karma/players?board_id=pvp_ranked&profile_ids=%s®ion_id=%s&season_id=%s" % (self.spaceid, self.platform_url, self.id, region, season))
File "C:\Users\leona\AppData\Local\Programs\Python\Python36\lib\site-packages\r6sapi\r6sapi.py", line 436, in get
raise InvalidRequest("HTTP Code: %s, Message: %s" % (data["httpCode"], msg), code=data["httpCode"])
r6sapi.r6sapi.InvalidRequest: HTTP Code: 404, Message: missing resource /public/r6karma/v1/players
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x0000025F2D32C940>
Process finished with exit code 1
Thanks in advance :)
in my script i used some variables (like kills and deaths in the current season) from the dictionary called _last_data, but with the new update it gave me NoneType.
Add the new ops from White Noise?
Need to find out if this data is even available first - but hopefully it is and this shouldn't be a particularly large change.
Anyone's welcome to PR this if they feel like it, just comment that you're doing it.
Running python 3.7.3. Trying the basic example:
import asyncio
import r6sapi as api
@asyncio.coroutine
def run():
auth = api.Auth("[email protected]", "secret_word")
player = yield from auth.get_player("stone-flake", api.Platforms.UPLAY)
operator = yield from player.get_operator("sledge")
print(operator.kills)
asyncio.get_event_loop().run_until_complete(run())
throws:
C:\Users\r6>python sample.py
336
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000002A70E0E6FD0>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x000002A70EA49390>, 108967.703)]', '[(<aiohttp.client_proto.ResponseHandler object at 0x000002A70EA58160>, 108968.687)]', '[(<aiohttp.client_proto.ResponseHandler object at 0x000002A70E9FB400>, 108969.234)]']
connector: <aiohttp.connector.TCPConnector object at 0x000002A70E9D9A20>
Not familiar w3ith asynio, so not sure where to even begin debugging. My login user/pwd pair is correct. If I try to login with intentionally bad credentials, I get a different fail:
r6sapi.exceptions.FailedToConnect: HTTP 401: Invalid credentials
Also, note, I pip install r6sapi
into my conda environment. I saw that aiohttp was version 2.3.10. See in the git repository it's supposed to be >= 2.3.3. So I uninstalled, reinstalled it with 2.3.3 but I still get the identical error.
The get operator function does not yet work on the Y3Q4 and later versions of the game
Hi, I can't find anywhere else to ask this so hopefully you can help.
I am currently writing an app that needs access to the ubi api. I noticed you are hitting this endpoint for the authentication:
https://connect.ubi.com/ubiservices/v2/profiles/sessions
.
I also see a bunch of other end points prefixed with public
, such as FETCH_STATISTIC = "https://public-ubiservices.ubi.com/v1/spaces/%s/sandboxes/%s/playerstats2/statistics?populations=%s&statistics=%s"
.
I am writing the app in in Node, so will need to make a small wrapper to handle all of this.
Any advice?
I just installed your api and copied the example starter code into a new python file. The only thing I changed was my email and password, and the ingame username to look up. I saw the earlier issue here and tried the fixes you said, didn't work. The error I am getting when running the example script is:
78
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x102dabda0>
Why is this happening and how can I fix it?
EDIT: I am using python version 3.5.4.
I'm missing my Ying Lesion and Ela 😢😜
Theres a problem with your api not showing the ranks correctly - gold IV is no longer in the game and the champion rank isnt shown, but diamond
So if I am correct, the authentication uses valid uplay details which I have provided, however I believe I know the issue and I am wondering if it is the case.
I am currently running python 3.9, and a lot of the module is outdated, what python version should I be using, as none is specified
No idea if this is the proper place to post this but doing a stat check of Blitz has a typo. instead of "Enemies Flashed" it says "Enemies Flahsed"
someone seems to have forgotten some commas in the OperatorStatisticNames dictionary
RainbowSixSiege-Python-API/r6sapi/operators.py
Lines 186 to 189 in a1c414b
Same as title, need to add support for new ops. Will do this over the weekend unless someone fancies making a PR
Today the new TS build should go live with Operation Steel Wave.
Normally after 3-4 Weeks of testing this makes it to the live build.
Yesterday in the reveal was shown that the MMR will be globalized, meaning that there is only one MMR rating instead of multiple ones for all the regions.
A big change is coming to our Matchmaking Rating system. In order to prevent matchmaking abuses while switching regions, we will be changing to unified MMRs for each playlist. This means that you will not have different MMRs depending on the region you play in. However, your matchmaking ranking will remain separate in different playlists.
Source: https://www.ubisoft.com/en-us/game/rainbow-six/siege/game-info/seasons/steelwave
All this could mean that there are upcomming changes for the API.
They could be:
My guess would be that they are going for option 3, since it is properly the easiest to implement.
This would also mean that there are no real changes required for this project (if they keep it like it is)
So if anyone knows a dev or has a direct channel maybe we could get some infomation about that... :)
Also are there API endpoints for the TS avaiable where we could validate this claim?
await player.get_rank(region,season=-1,data=None)
This does not work saying region is not defined
when I delete region, it says I need it
All that's involved in this ticket is to push the changes that have already been made to pypi and up the version number.
Something only I can do
add the ability to use the player's uplayid to get the player info
Your example code in the Github Repository is different then in your documentation.
Github: https://i.imgur.com/jARDfiK.png
Documentation: https://i.imgur.com/wbKXvYR.png
Error when typing 'pip install r6sapi'
Output/Error:
ERROR: Command errored out with exit status 1: 'c:\users\zacis\appdata\local\programs\python\python37\python.exe' 'c:\users\zacis\appdata\local\programs\python\python37\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\zacis\AppData\Local\Temp\pip-build-env-f23exrcu\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel Check the logs for full command output.`
NOTE: My PIP and Python work fine; this is the only error I've had installing a package.
Running player.kills
returns an AttributeError: 'Player' object has no attribute 'kills'
Documentation states that Player
should have this property, among others
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.