pysmash icon indicating copy to clipboard operation
pysmash copied to clipboard

Access objects via id

Open LuNoX opened this issue 8 years ago • 18 comments

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)

LuNoX avatar Nov 24 '16 18:11 LuNoX

Hey @LuNoX, Just curious... What api objects are you specifically trying to grab and why? My initial desire for the wrapper was to completely avoid/circumvent making calls that mimic smash.gg's developer api, since then there would be no difference from using pysmash and just hitting their api directly. Would this/these methods just be a convenience? I thought I had extracted most pertinent information one could want from their endpoints while filtering out all of the useless (useless IMO) stuff that bloat their api responses. Getting a raw phase object, for instance, strikes me an unnecessary (but I also do not know what project you are using pysmash for)

PeterCat12 avatar Nov 25 '16 03:11 PeterCat12

Sets mostly. I am writing a Discord bot that notifies you once you're next match is up. That's why I need to update set information constantly, so I can check wether or not a new set needs to be played.

LuNoX avatar Nov 25 '16 05:11 LuNoX

And yes it would be a convenience becausd I just learned python and I dont (yet) know how do something like this (in a not bad way).

LuNoX avatar Nov 25 '16 05:11 LuNoX

AH. Very cool! Keep in mind that it is probably a bad idea to ever update something "constantly" as that would involve hammering smash.gg's API with requests. I will try to find some time this weekend to implement this thought.

PeterCat12 avatar Nov 25 '16 06:11 PeterCat12

I meant 'constantly' as in 'every time I type !matchups'. So don't worry about me making too many unnecessary api calls :)

LuNoX avatar Nov 25 '16 06:11 LuNoX

P.S. I hate not being able to edit these comments cause it's early in the morning for me and I'm typing like shit

LuNoX avatar Nov 25 '16 06:11 LuNoX

No worries :)

PeterCat12 avatar Nov 25 '16 06:11 PeterCat12

Sooooo, is this more difficult to implement than you thought or did you just not get around to doing it?

LuNoX avatar Dec 10 '16 11:12 LuNoX

Unfortunately I just haven't gotten around to doing it. I'm under a bit of a deadline for another project I'm working on so this specific functionality isn't a super high priority for me. I do encourage you to Fork the repo and open a PR though :)

PeterCat12 avatar Dec 10 '16 16:12 PeterCat12

Ok, I'll just wait though. I've got other projects to work on in the meantime.

Peter Wensel [email protected] schrieb am Sa., 10. Dez. 2016 um 17:13 Uhr:

Unfortunately I just haven't gotten around to doing it. I'm under a bit of a deadline for another project I'm working on so this specific functionality isn't a super high priority for me. I do encourage you to Fork the repo and open a PR though :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/PeterCat12/pysmash/issues/30#issuecomment-266219085, or mute the thread https://github.com/notifications/unsubscribe-auth/AVGSlOKVVC5taDRM4k4r6VVSCLbmRxvfks5rGs-rgaJpZM4K74hK .

LuNoX avatar Dec 10 '16 16:12 LuNoX

I forked the project and did a shitty version of a set_show method. Would be nice if you merged it or implemented a non-shitty version of it yourself, so that I don't have to every time you update the repo.

LuNoX avatar Jan 12 '17 18:01 LuNoX

I also implemented a very basic version of the show_me_any_type_of_object method

LuNoX avatar Jan 12 '17 19:01 LuNoX

open a PR and I'll take a look!

PeterCat12 avatar Jan 12 '17 19:01 PeterCat12

done

LuNoX avatar Jan 12 '17 19:01 LuNoX

For future reference, you should never have to rewrite your code every time in your fork. All you need to do is merge this master down into your fork and resolve any merge conflicts. And in your project just pip install from your fork.

PeterCat12 avatar Jan 12 '17 19:01 PeterCat12

Thanks, as you can tell still kinda new to git.

LuNoX avatar Jan 12 '17 19:01 LuNoX

no worries man :)

PeterCat12 avatar Jan 12 '17 19:01 PeterCat12

@PeterCat12 this issue should be closed, no?

nyarbin avatar Apr 18 '18 18:04 nyarbin