How can i find out the actual date of satellite image from Processing API?

from oauthlib.oauth2 import BackendApplicationClient
from requests_oauthlib import OAuth2Session
import json
import requests
from datetime import datetime

Your client credentials

client_id = ‘…’
client_secret = ‘…’

Create a session

client = BackendApplicationClient(client_id=client_id)
oauth = OAuth2Session(client=client)

Get token for the session

token = oauth.fetch_token(token_url=‘https://services.sentinel-hub.com/auth/realms/main/protocol/openid-connect/token’,
client_secret=client_secret, include_client_id=True)

url = “http://services.sentinel-hub.com/api/v1/process
access_token = token[“access_token”]

payload = {
“input”: {
“bounds”: {
“geometry”: {
“type”: “Polygon”,
“coordinates”: [
[
// coordinates
]
]
}
},
“data”: [
{
“type”: “S2L2A”,
“dataFilter”: {
“timeRange”: {
“from”: “2024-01-01T00:00:00Z”,
“to”: “2024-01-06T23:59:59Z”
}
}
}
]
},
“output”: {
“width”: 512,
“height”: 512
}
}

evalscript = “”"
let index = (1-((B06B07B8A)/B04)**0.5)*((B12-B8A)/((B12+B8A)**0.5)+1);
let min = 0;
let max = 0.99;
let zero = 0.5;

let underflow_color = [1, 1, 1];
let low_color = [0/255, 0/255, 255/255];
let high_color = [255/255, 20/255, 20/255];
let zero_color = [250/255, 255/255, 10/255];
let overflow_color = [255/255, 0/255, 255/255];

return colorBlend(index, [min, min, zero, max],
[
underflow_color,
low_color,
zero_color,
high_color,
overflow_color
]);
“”"

files = {
‘request’: (‘’, json.dumps(payload)),
‘evalscript’: (‘’, evalscript)
}

headers = {
‘Authorization’: f’Bearer {access_token}’
}

response = requests.post(url, headers=headers, files=files)

if response.status_code == 200:
file_path = f"./image.png"
with open(file_path, ‘wb’) as f:
f.write(response.content)
print(f"Image saved as {file_path}")
else:
print(“Failed:”, response.text + str(response.status_code))

“”" This processing api sample return an image according to timeRange. My question is that Can i know actual date of the satellite image ? “”"

Hi,

this question has been answered several times in the forum in the past:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.