Closed bmeares closed 3 years ago
Thanks for PR'ing this!
Everything passed when I ran pytest
iirc I was really lazy with the tests so I wouldn't rely on pytest much (my testing strategy was to just write code that used whatever functionality I was testing and if the output looked alright then great)
Below is an example implementation in FastAPI:
Awesome! I'd actually encourage you to submit another PR (or you can include it with this one) that adds this to the /examples
subdirectory since it may be useful for others :)
Over the weekend, I was mentoring at a hackathon, and a team was trying to use this library. We couldn't figure out how to get the callback from Spotify working, so I poked around the source.
User.from_code()
was always returning a coroutine, even when awaiting the function or usingimport spotify.sync as spotify
. Removingawait
fromreturn await cls.from_token(client, token, refresh_token)
seemed to do the trick.I hope this change doesn't break other functionality. Everything passed when I ran
pytest
, I suspectUser.from_code()
might not be covered. I tried writing a new unit test but wasn't sure how to get a valid code without spinning up a web server.Admittedly I'm not as comfortable with
async
as I'd like to be, but nowawait spotify.User.from_code(...)
seems to work. Below is an example implementation in FastAPI: