{"id":440,"date":"2024-11-01T15:48:29","date_gmt":"2024-11-01T07:48:29","guid":{"rendered":"https:\/\/my.di.cloudns.asia\/?p=440"},"modified":"2024-11-01T15:48:29","modified_gmt":"2024-11-01T07:48:29","slug":"firsty%e8%87%aa%e5%8a%a8%e5%88%b7%e6%96%b0%e7%9a%84python%e8%84%9a%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/my.di.cloudns.asia\/index.php\/2024\/11\/01\/440.html","title":{"rendered":"Firsty\u81ea\u52a8\u5237\u65b0\u7684Python\u811a\u672c"},"content":{"rendered":"<p>\u901a\u8fc7\u6293\u5305\u83b7\u53d6\u5bf9\u5e94\u7684key\uff0c\u5728\u811a\u672c\u91cc\u9762\u8fdb\u884c\u66ff\u6362\u5c31\u597d\u4e86\u3002<\/p>\n<pre><code>import requests\nimport json\n\n# \u7b2c\u4e00\u4e2aHTTP\u8bf7\u6c42\u83b7\u53d6access_token\nurl1 = &quot;https:\/\/securetoken.googleapis.com\/v1\/token?key=AIzaSyAw4dSOEuZNgBWLAiwSAqPJ9qArvSOaZDM&quot;\nheaders1 = {\n    &#039;Accept-Encoding&#039;: &#039;gzip, deflate, br&#039;,\n    &#039;Accept&#039;: &#039;*\/*&#039;,\n    &#039;Connection&#039;: &#039;keep-alive&#039;,\n    &#039;Content-Type&#039;: &#039;application\/json&#039;,\n    &#039;Host&#039;: &#039;securetoken.googleapis.com&#039;,\n    &#039;X-Ios-Bundle-Identifier&#039;: &#039;com.firsty.app&#039;,\n    &#039;User-Agent&#039;: &#039;FirebaseAuth.iOS\/10.25.0 com.firsty.app\/1.0.352 iPad\/17.5.1 hw\/iPad11_3&#039;,\n    &#039;Accept-Language&#039;: &#039;en&#039;,\n    &#039;X-Client-Version&#039;: &#039;iOS\/FirebaseSDK\/10.25.0\/FirebaseCore-iOS&#039;,\n    &#039;X-Firebase-GMPID&#039;: &#039;1:962364472393:ios:fede98035afd07718c1398&#039;\n}\nbody1 = {\n    &quot;grantType&quot;: &quot;refresh_token&quot;,\n    &quot;refreshToken&quot;: &quot;AMf-vBz7n9WMvp2B8XQ_E3BXG4xmd49pD60Ga5FR8cdJRv4XfwwilH2mpG4H6aUTaOYqFHssRchRdvC8AANTPJ4W7AOWks9_TQocd1gFnFRF5Yzdr7VJKxQw93PwnmGaqy9n_6oq49-fbzNsBx75EfgBmDvv590fh7oMCioAL5ZqT5MqRfSMJuu9U2xU0OHBZ76s_qcAZB1sUzdSp16-oodJNMvHDa5PpVXcF5oO6jh-KqzYLaHwAGXLD415dUxPLTLm4BJntguwP2TiD7GA8fZ3gEHgSIQTCn3jUYp7qcho0_6jn1-lJuh9RNct69jzHXUka3AHGMjDiZ0g2WDK4h1A3xE01ilrY_qrlorUVAWgWQY96mMKzcrGbyC_AB3KZJBb7MALXH2LzWgCMGTKSzza7b9slZC5aY9wxMEat0Nm9f4-FxJB_YE&quot;\n}\n\nresponse1 = requests.post(url1, headers=headers1, json=body1)\n\nif response1.status_code == 200:\n    access_token = response1.json().get(&quot;access_token&quot;)\n    if access_token:\n        # \u7b2c\u4e8c\u4e2aHTTP\u8bf7\u6c42\u4f7f\u7528\u83b7\u53d6\u5230\u7684access_token\n        url2 = &quot;https:\/\/backoffice.firsty.app\/api\/mobile\/subscriptions\/v2\/ypeoTC3zuzPY4AQO1goTi41C5gj1\/iccid\/893107062434918716\/free&quot;\n\n        headers2 = {\n            &quot;user-agent&quot;: &quot;Dart\/3.4 (dart:io)&quot;,\n            &quot;accept-encoding&quot;: &quot;gzip&quot;,\n            &quot;authorization&quot;: f&quot;Bearer {access_token}&quot;,  # \u4f7f\u7528\u83b7\u53d6\u5230\u7684access_token\n            &quot;app-build&quot;: &quot;3938&quot;,\n            &quot;content-type&quot;: &quot;application\/json&quot;,\n            &quot;app-version&quot;: &quot;1.0.352&quot;\n        }\n\n        data2 = {\n            &quot;planType&quot;: &quot;ADVERTISEMENT&quot;,\n            &quot;deviceId&quot;: &quot;UKQ1230924001&quot;,\n            &quot;country&quot;: &quot;US&quot;\n        }\n\n        response2 = requests.post(url2, headers=headers2, json=data2)\n\n        if response2.status_code == 200:\n            print(response2.json())\n        else:\n            print(f&quot;Second request failed with status code: {response2.status_code}&quot;)\n    else:\n        print(&quot;Access token not found in the response&quot;)\nelse:\n    print(f&quot;First request failed with status code: {response1.status_code}&quot;)<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u901a\u8fc7\u6293\u5305\u83b7\u53d6\u5bf9\u5e94\u7684key\uff0c\u5728\u811a\u672c\u91cc\u9762\u8fdb\u884c\u66ff\u6362\u5c31\u597d\u4e86\u3002 import requests import json  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-440","post","type-post","status-publish","format-standard","hentry","category-12"],"_links":{"self":[{"href":"https:\/\/my.di.cloudns.asia\/index.php\/wp-json\/wp\/v2\/posts\/440","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/my.di.cloudns.asia\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/my.di.cloudns.asia\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/my.di.cloudns.asia\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/my.di.cloudns.asia\/index.php\/wp-json\/wp\/v2\/comments?post=440"}],"version-history":[{"count":1,"href":"https:\/\/my.di.cloudns.asia\/index.php\/wp-json\/wp\/v2\/posts\/440\/revisions"}],"predecessor-version":[{"id":441,"href":"https:\/\/my.di.cloudns.asia\/index.php\/wp-json\/wp\/v2\/posts\/440\/revisions\/441"}],"wp:attachment":[{"href":"https:\/\/my.di.cloudns.asia\/index.php\/wp-json\/wp\/v2\/media?parent=440"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/my.di.cloudns.asia\/index.php\/wp-json\/wp\/v2\/categories?post=440"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/my.di.cloudns.asia\/index.php\/wp-json\/wp\/v2\/tags?post=440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}