Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calling to API service
#1
Hi everybody,

I am new in python and in code, I am trying to call a API service but I did not get the json structured. I am using anaconda and spyder.

the first code work well (Setting SERP Tasks), but when I tried to get json structured with the second code (Get SERP Results by task_id), I could not.

the documentation is here docs.dataforseo.com/#get-serp-results-by-task_id

Thank you

the second code is:

from client import RestClient
client = RestClient("[email protected]", "xxxxxxxxDxxxtmC")
completed_tasks_response = client.get("/v2/srp_tasks_get")
if completed_tasks_response["status"] == "error":
    print("error. Code: %d Message: %s" % (completed_tasks_response["error"]["code"], completed_tasks_response["error"]["message"]))
else:
    results = completed_tasks_response["results"]
    print(results)
    for result_id in results:
        result = results[result_id]
        srp_response = client.get("/v2/srp_tasks_get/%d" % (result["152047284"]))
        if srp_response["status"] == "error":
            print("error. Code: %d Message: %s" % (srp_response["error"]["code"], srp_response["error"]["message"]))
        else:
            print(srp_response["results"])
Reply
#2
What error(s) are you getting?
Reply
#3
I did not get error I did not receive anything
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Create Service like window service jesssajan 3 2,981 Mar-06-2020, 01:09 PM
Last Post: ibreeden
  Error trying to Calling web service stahorse 2 2,422 May-22-2019, 09:09 AM
Last Post: stahorse

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020