Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check-in sample code #60

Open
tommynanny opened this issue Sep 6, 2022 · 4 comments
Open

check-in sample code #60

tommynanny opened this issue Sep 6, 2022 · 4 comments

Comments

@tommynanny
Copy link

Hi, I was wondering how I could use this repo to implement the check-in function for genshin impact in my own python project. Let's say I have a cookie for an account. A code snippet would be helpful.

@y1ndan
Copy link
Owner

y1ndan commented Sep 6, 2022

import genshinhelper as gh

cookie = 'account_id=16393939; cookie_token=jPjdK4yd7oeIifkdYhkFhkkjde00hdUgh'
g = gh.Genshin(cookie)
g.sign()
# g.month_dairy

@tommynanny
Copy link
Author

#!/usr/bin/env python

import genshinhelper as gh

cookie = "***"

g = gh.Genshin(cookie)
g.sign()

我用上面代码一直显示login expired :(
我是重新刚去米游社获取的cookie

2022-12-10 01:10:01 INFO Preparing to get check-in information ...
2022-12-10 01:10:02 INFO Preparing to get user game roles information ...
2022-12-10 01:10:02 ERROR Login expired. Please log in again.
Traceback (most recent call last):
  File "/Users/tommynanny/Desktop/genshin/./tesy.py", line 10, in <module>
    g.sign()
  File "/Users/tommynanny/opt/anaconda3/lib/python3.9/site-packages/genshinhelper/core.py", line 115, in sign
    user_data = self.user_data
  File "/Users/tommynanny/opt/anaconda3/lib/python3.9/site-packages/genshinhelper/core.py", line 102, in user_data
    roles_info = self.roles_info
  File "/Users/tommynanny/opt/anaconda3/lib/python3.9/site-packages/genshinhelper/core.py", line 58, in roles_info
    raise GenshinHelperException(response.get('message'))
genshinhelper.exceptions.GenshinHelperException: Login expired. Please log in again.

@y1ndan
Copy link
Owner

y1ndan commented Dec 10, 2022

详见 #4

@tommynanny
Copy link
Author

tommynanny commented Dec 10, 2022

感激,最近签到有些账号一直是 Expecting value: line 1 column 1 (char 0), 我把cookie提出来都可以获取role,但是签到就会有问题,这个是用的docker hub上的image

    Total monthly check-ins: 1 days
    Status: OK
    Traveler month 12 diary
    💠primogems: 0
    🌕mora: 0
    ##################
🌈 No.11:
    Expecting value: line 1 column 1 (char 0)
🌈 No.12:
    Expecting value: line 1 column 1 (char 0)
🌈 No.13:
    Expecting value: line 1 column 1 (char 0)
🌈 No.14:
    Expecting value: line 1 column 1 (char 0)
🌈 No.15:
    Expecting value: line 1 column 1 (char 0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants