代码之家  ›  专栏  ›  技术社区  ›  TEe

如何调用api python循环下一个参数页

  •  -2
  • TEe  · 技术社区  · 2 年前
    • 调用API python循环下一个参数pages 1000 limit

    • 但我找不到任何回应数据

        import requests
        import json
      
        def call_api():
        url = "https://api.apitest.com/api/v2/intelligence/?&q=((status='status') and (confidence>=confidence) and (country='country'))"
        api_key ="apikey"
        user = "user@user.co.th"
      
        headers = {
          "Content-Type": "application/json",
          "Authorization": "apikey " + user + ":" + api_key,
        }
        response = requests.get(url, headers=headers, verify=False)
      
        if response.status_code != 200:
          return {}
        return response.json()
      
        results = []
        while True:
          result = call_api()
            if result.get("meta", {}).get("next") is None:
          break
        results.append(result)
      
    • 响应数据,但我找不到任何响应数据

         PS C:\xampp\htdocs\Dev> &C:/Users/User/AppData/Local/Microsoft/WindowsApps/python3.10.exe"c:/xampp/htdocs/Dev/api/api/get-loop.py"
         C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.
         Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\urllib3\connectionpool.py:1043: InsecureRequestWarning: Unverified HTTPS request is being made to host 'api.apitest.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
           warnings.warn(
         PS C:\xampp\htdocs\Dev> 
      
    0 回复  |  直到 2 年前