马上注册,免受广告困扰,轻松兑换eSIM!
您需要 登录 才可以下载或查看,没有账号?注册
×
通过抓包获取对应的key,在脚本里面进行替换就好了。
import requests
import json
# 第一个HTTP请求获取access_token
url1 = "https://securetoken.googleapis.com/v1/token?key=AIzaSyAw4dSOEuZNgBWLAiwSAqPJ9qArvSOaZDM"
headers1 = {
'Accept-Encoding': 'gzip, deflate, br',
'Accept': '*/*',
'Connection': 'keep-alive',
'Content-Type': 'application/json',
'Host': 'securetoken.googleapis.com',
'X-Ios-Bundle-Identifier': 'com.firsty.app',
'User-Agent': 'FirebaseAuth.iOS/10.25.0 com.firsty.app/1.0.352 iPad/17.5.1 hw/iPad11_3',
'Accept-Language': 'en',
'X-Client-Version': 'iOS/FirebaseSDK/10.25.0/FirebaseCore-iOS',
'X-Firebase-GMPID': '1:962364472393:ios:fede98035afd07718c1398'
}
body1 = {
"grantType": "refresh_token",
"refreshToken": "AMf-vBz7n9WMvp2B8XQ_E3BXG4xmd49pD60Ga5FR8cdJRv4XfwwilH2mpG4H6aUTaOYqFHssRchRdvC8AANTPJ4W7AOWks9_TQocd1gFnFRF5Yzdr7VJKxQw93PwnmGaqy9n_6oq49-fbzNsBx75EfgBmDvv590fh7oMCioAL5ZqT5MqRfSMJuu9U2xU0OHBZ76s_qcAZB1sUzdSp16-oodJNMvHDa5PpVXcF5oO6jh-KqzYLaHwAGXLD415dUxPLTLm4BJntguwP2TiD7GA8fZ3gEHgSIQTCn3jUYp7qcho0_6jn1-lJuh9RNct69jzHXUka3AHGMjDiZ0g2WDK4h1A3xE01ilrY_qrlorUVAWgWQY96mMKzcrGbyC_AB3KZJBb7MALXH2LzWgCMGTKSzza7b9slZC5aY9wxMEat0Nm9f4-FxJB_YE"
}
response1 = requests.post(url1, headers=headers1, json=body1)
if response1.status_code == 200:
access_token = response1.json().get("access_token")
if access_token:
# 第二个HTTP请求使用获取到的access_token
url2 = "https://backoffice.firsty.app/api/mobile/subscriptions/v2/ypeoTC3zuzPY4AQO1goTi41C5gj1/iccid/893107062434918716/free"
headers2 = {
"user-agent": "Dart/3.4 (dart:io)",
"accept-encoding": "gzip",
"authorization": f"Bearer {access_token}", # 使用获取到的access_token
"app-build": "3938",
"content-type": "application/json",
"app-version": "1.0.352"
}
data2 = {
"planType": "ADVERTISEMENT",
"deviceId": "UKQ1230924001",
"country": "US"
}
response2 = requests.post(url2, headers=headers2, json=data2)
if response2.status_code == 200:
print(response2.json())
else:
print(f"Second request failed with status code: {response2.status_code}")
else:
print("Access token not found in the response")
else:
print(f"First request failed with status code: {response1.status_code}")
|