petercat12 / pysmash Goto Github PK
View Code? Open in Web Editor NEWA python wrapper to smash.gg Developer API
A python wrapper to smash.gg Developer API
In setup.py as well as requirements.py it says that pysmash needs requests 2.12.1, while in the readme.md it says requests 2.10.0.
I only have a test size of 1, but it seems like for a multistage event, if one of the events hasn't started yet. I'm not sure why this would happen. The following is the traceback:
Traceback (most recent call last):
File "C:\Users\invat\OneDrive\Documents\Python\SmashStream\SmashGGSupport.py", line 40, in
sso = SmashGGSupportObject( tournamentName, event)
File "C:\Users\invat\OneDrive\Documents\Python\SmashStream\SmashGGSupport.py", line 10, in init
self.players = self.smash.tournament_show_players(self.tournamentID,self.event)
File "C:\Python36\lib\site-packages\pysmash\smashgg.py", line 51, in tournament_show_players
return tournaments.show_players(tournament_name, tournament_params, event)
File "C:\Python36\lib\site-packages\pysmash\tournaments.py", line 61, in show_players
bracket_players = brackets.players(bracket_id)
File "C:\Python36\lib\site-packages\pysmash\brackets.py", line 13, in players
response = _filter_player_response(response)
File "C:\Python36\lib\site-packages\pysmash\brackets.py", line 83, in _filter_player_response
entrants = response['entities']['entrants']
KeyError: 'entrants'
As a work around for myself atm, I've changed response['entities']['entrants']
to response['entities'].get('entrants')
and return an empty list if that returns None. This seems to get me by for now. Haven't had time to trace it all the way down yet, but does the library try to obtain players for each phase/pool/bracket of the event separately? If so I wonder if Smash.gg doesn't even give that field until after that stage is "Primed with players" from the previous stage, as once all the previous stages are complete the problem goes away and the entrants key magically appears in the response.
Sorry if this was long winded.
There's a typo in the first paragraph of Basic Usage: it says "isntance" istead of "instance".
Also there are some problems with the tournaments_show_events block:
I currently do not see a way to get the data of any api object based on their id other than tournaments.
It would be good to have something like this:
api-object = smash.show_api-object-type(api-object-id)
that returns a dict with the matching data.
Alternatively something like this would work as well:
anything = smash.show(anything-id, anything-object-type)
When accessing a bracket's sets that doesn't have any (because it i.e. doesn't have any participants yet) like this:
sets = smash.bracket_show_sets(bracket_id_of_bracket_that_doesnt_have_sets)
you get this:
In get Sets:
File "C:\Program Files\Python35\lib\site-packages\discord\ext\commands\core.py", line 50, in wrapped
ret = yield from coro(*args, **kwargs)
File "C:\Users\Timo\PycharmProjects\Smashy-Bot\cogs\smashy.py", line 85, in get_sets
sets = smash.bracket_show_sets(bracket)
File "C:\Program Files\Python35\lib\site-packages\pysmash\smashgg.py", line 53, in bracket_show_sets
return brackets.sets(bracket_id, filter_response)
File "C:\Program Files\Python35\lib\site-packages\pysmash\brackets.py", line 24, in sets
response = _filter_set_response(response)
File "C:\Program Files\Python35\lib\site-packages\pysmash\brackets.py", line 111, in _filter_set_response
bracket_sets = response['entities']['sets']
KeyError: 'sets'
With 1.2.4 you broke tournament_show_sets it now either raises a ResponseError or returns an empty list.
Since you only include WiiU events as valid events, every other type of event throws a ValidationError, including melee, which is way more popular than Sm4sh.
This also makes it impossible to look for custom events that aren't related to smash (like Rivals of Aether, Clash Royale, Guilty Crown, Street Fighter,...)
Something like:
events = smash.tournament_show_events(tourney_name)
is missing currently.
Some querys for sets don't return all sets. For example the query for the bracket with id 273020 using bracket_show_set only returns 1 set with id 6460971. It instead should be returning 3 as seen here.
It does the same with the bracket with id 269808.
I have no idea what could be causing this and it was fine about two weeks ago and now it just doesn't work anymore. My suspicion is that the smash.gg adding the search feature messed with some parts of the api.
In the util.py file you have the following code:
if param not in valid_params:
error_msg = """
'{0}' is not a valid query param for route of type: {1}.
Valid types are [{2}].
""".format(param, route_type, ', '.join(valid_params))
raise exceptions.ValidationError(error_msg)
Is there a way to store the list of valid query types via a call to your API? If I'm trying to extract the bracket for Ultimate-Singles, it is helpful to know which of many different slug variants is actually used in the a given tournament, without iteratively trying each one.
Is there still a way to return all sets? I kinda need the ones that haven't been played yet instead of the ones that did...
Hey, some of the tournaments in our region use Smash.gg with on site tournament registration, and some of the players don't have any contact info. This causes issues when I try any of the show player calls. An example of such a tournament is ID 2927.
Just wanted to know if you're gonna bring the wrapper up to date with the Smash.gg API changes or if this repo is gonna be dead.
tournament_show_events function only returns the names. I'm not sure if this is intended but this approach is different from all other show_ methods where you get all data (including id which is kinda important)
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.