Hi,
I asked this question in the API for Python forum, but I figure it's relevant here as well. I'll delete if cross-posts are frowned upon.
What I'm trying to do is access the 'status' property of the JSON response to a successful Create Replica call. In the documentation, it says the the response from the call is the statusURL, and that URL links to a webpage containing these properties and example values:
{
"transportType":"esriTransportTypeUrl",
"responseType": "esriReplicaResponseTypeData",
"replicaName": "Meters",
"resultUrl": "https://arcgis.com/lidGgNLxw9LL0SbI/ArcGIS/rest/services/SaveTheBay/replicafiles/c2f366ffbf5549a4872...",
"submissionTime": 1379366479000,
"lastUpdatedTime": 1379366482000,
"status": "Completed"
}
I'm trying to access the 'status' property, but I can't find documentation on how to do that. Is it possible? I can access the HTML text of the page through response.text after a request.get call to the statusURL, but I don't know how to access that status value.
Any help would be most appreciated!
Would something like this work?
import json
Thank you very much for the idea, unfortunately though, I wasn't able to get it to work. The code returns a type error passing the response object:
TypeError: expected str, bytes or os.PathLike object, not Response
I also tried
with open(r.json()) as f:
data = json.load(f)
statusString = data["status"]
but that also errored with :
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
I think I'm just going to get the response.text and parse it for the status for now.