AJiaJiShu commited on
Commit
3a74a5d
·
verified ·
1 Parent(s): d129d35

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -194,13 +194,11 @@ async def get_image(xid, change_ip):
194
  return result
195
 
196
 
197
- async def sign_in(device_id, username, password, client_id, captcha_token, change_ip):
198
  url = "https://user.pikpak.me/v1/auth/signin"
199
 
200
  headers = {
201
  "X-Captcha-Token": captcha_token,
202
- # "X-Device-ID": device_id,
203
- # "x-client-id": client_id,
204
  'X-Forwarded-For': str(change_ip)
205
  }
206
 
@@ -491,13 +489,15 @@ async def login():
491
  user_agent = await get_user_agent()
492
  action_init = await init(client_id1, device_id, user_agent, email, change_ip)
493
  captcha_token = action_init["captcha_token"]
494
- while True:
495
- img_info = await get_image(device_id, change_ip)
496
- if img_info['response_data']['result'] == 'accept':
497
- print('验证通过!!!')
498
- break
499
- token_data = await get_new_token(img_info, device_id, captcha_token, change_ip)
500
- login_data = await sign_in(device_id, email, password, client_id1, token_data['captcha_token'], change_ip)
 
 
501
  return jsonify({"code": 200, "data": login_data, "msg": 'success'}), 200
502
  except Exception as e:
503
  print(e)
 
194
  return result
195
 
196
 
197
+ async def sign_in(username, password, client_id, captcha_token, change_ip):
198
  url = "https://user.pikpak.me/v1/auth/signin"
199
 
200
  headers = {
201
  "X-Captcha-Token": captcha_token,
 
 
202
  'X-Forwarded-For': str(change_ip)
203
  }
204
 
 
489
  user_agent = await get_user_agent()
490
  action_init = await init(client_id1, device_id, user_agent, email, change_ip)
491
  captcha_token = action_init["captcha_token"]
492
+ if 'url' in action_init.keys():
493
+ while True:
494
+ img_info = await get_image(device_id, change_ip)
495
+ if img_info['response_data']['result'] == 'accept':
496
+ print('验证通过!!!')
497
+ break
498
+ token_data = await get_new_token(img_info, device_id, captcha_token, change_ip)
499
+ captcha_token = token_data['captcha_token']
500
+ login_data = await sign_in(email, password, client_id1, captcha_token, change_ip)
501
  return jsonify({"code": 200, "data": login_data, "msg": 'success'}), 200
502
  except Exception as e:
503
  print(e)