thesadru / genshinstats

PLEASE USE GENSHIN.PY A python library that can get the stats of Genshin Impact players using Mihoyo's API. PLEASE USE GENSHIN.PY
https://thesadru.github.io/pdoc/genshinstats/
MIT License
267 stars 38 forks source link

following error exists in current version #20

Closed CustomIcon closed 3 years ago

CustomIcon commented 3 years ago
genshinstats/genshinstats.py line 84, in get_browser_cookies
    import browser_cookie3 # optional library
ModuleNotFoundError: No module named 'browser_cookie3'

maybe:

try:
  import browser_cookie3
except ImportError:
  pass
CustomIcon commented 3 years ago

here is the example code i used:


import genshinstats as gs
import time

gs.set_cookie_auto()

while True:
    reward = gs.claim_daily_reward()
    if reward is not None:
        print(f"Claimed daily reward - {reward['cnt']}x {reward['name']}")
    else:
        print("Could not claim daily reward")
    time.sleep(24*60*60 - 2)```
thesadru commented 3 years ago

browser-cookie3 is an optional dependency because it's only required for set_cookie_auto. If you want to use it you must install the library yourself. Raising an error is the intended behavior.

CustomIcon commented 3 years ago

oh, maybe we can let the user know about this and raise an error that instruct on how to install the library ina simple line?

thesadru commented 3 years ago

Sure, seems reasonable.