uberfastman / yfpy

Python API wrapper for the Yahoo Fantasy Sports public API (supports NFL, NHL, MLB, and NBA).
https://pypi.org/project/yfpy/
GNU General Public License v3.0
178 stars 46 forks source link

Running it in a container #47

Closed umumpaul closed 10 months ago

umumpaul commented 11 months ago

Have you ever run this package in a container setup? I guess because of python official image, or lightweight linux like alphin, does not come with a browser. Another reason I can think of is the callback (localhost:8080) is not working, albeit I open the port during start. Any tips is welcome.

uberfastman commented 10 months ago

Hi @umumpaul, thanks so much for using YFPY! I use it in Docker myself in my other fantasy football app all the time, but I realize it is not clear how to do so. In order to avoid the need for opening a browser window, you can set browser_callback = False when constructing your YahooFantasySportsQuery object. Then it will output a URL to the command line that you can navigate to with any browser to retrieve the verifier code and input that back into the command line.

That being said, I just released v15.0.0 in #48, which includes the addition of a Docker compose.yaml file and a Dockerfile to the project so you can easily get things going in Docker, and using the env var defined in the compose.yaml, the package will now check that env var and if it is set to "docker" then it will automatically set browser_callback = False (instead of its default True value). Hopefully this makes it easier for you to use in a containerized environment going forward.