Aug-25-2017, 03:12 PM
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:
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"])