Hi all.
I am exploring the process API and have managed to make some requests in Postman.
I used Python code generated from Postman to do the same from a simple Python script. There were some obvious syntax errors around the evalscript string value, but after resolving this and attempting to execute the script, I am constantly presented with “HTTP 400 Bad Request”,“code”:“RENDERER_EXCEPTION”
I have tried looking for similar posts, but none were really helpful. Maybe someone can point me in the right direction. Here is my code:
import requests
import json
url = "https://services.sentinel-hub.com/api/v1/process"
payload = {
"request": {
"input": {
"bounds": {
"bbox": [
1360000, 5121900, 1370000, 5131900
],
"properties": {
"crs": "http://www.opengis.net/def/crs/EPSG/0/3857"
}
},
"data": [
{
"type": "sentinel-1-grd",
"dataFilter": {
"timeRange": {
"from": "2019-02-02T00:00:00Z",
"to": "2019-04-02T23:59:59Z"
}
},
"processing": {
"orthorectify": "true",
"demInstance": "COPERNICUS_30"
}
}
]
},
"output": {
"width": 512,
"height": 512,
"responses": [
{
"identifier": "default",
"format": {
"type": "image/png"
}
}
]
}
},
"evalscript": """//VERSION=3
function setup() {
return {
input: [\"VV\"],
output: {
id:\"default\", bands: 1
}
}
}
function evaluatePixel(samples) {
return [2 * samples.VV]
}"""
}
files = [
]
headers = {
'Content-Type': 'multipart/form-data',
'Accept': 'image/png',
'Authorization': 'Bearer <token>'
}
data = json.dumps(payload)
print("HEADERS", headers)
print("DATA", data)
response = requests.request(
"POST", url, headers=headers, data=data, files=None) #also tried payload for data param, as well as in json param, no luck
print(response.text)