Calling to API service - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Calling to API service (/thread-4551.html) |
Calling to API service - julius - Aug-25-2017 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"]) RE: Calling to API service - nilamo - Aug-25-2017 What error(s) are you getting? RE: Calling to API service - julius - Aug-25-2017 I did not get error I did not receive anything |