PeterCat12 / pysmash

A python wrapper to smash.gg Developer API
22 stars 11 forks source link

Access objects via id #30

Open LuNoX opened 7 years ago

LuNoX commented 7 years ago

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)

PeterCat12 commented 7 years ago

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)

LuNoX commented 7 years ago

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 commented 7 years ago

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).

PeterCat12 commented 7 years ago

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.

LuNoX commented 7 years ago

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

LuNoX commented 7 years ago

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

PeterCat12 commented 7 years ago

No worries :)

LuNoX commented 7 years ago

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

PeterCat12 commented 7 years ago

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 :)

LuNoX commented 7 years ago

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

Peter Wensel notifications@github.com 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 commented 7 years ago

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 commented 7 years ago

I also implemented a very basic version of the show_me_any_type_of_object method

PeterCat12 commented 7 years ago

open a PR and I'll take a look!

LuNoX commented 7 years ago

done

PeterCat12 commented 7 years ago

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.

LuNoX commented 7 years ago

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

PeterCat12 commented 7 years ago

no worries man :)

nyarbin commented 6 years ago

@PeterCat12 this issue should be closed, no?