Dear all,
I currently have 100 km2 of SPOT data and I wanted to directly download the Geotiffs through Python using my Sentinelhub account.
Could someone help me for the next steps to download data using the API? I am quite new on this area and I do not know if it is possible to “export data”, rather than Import into the Sentinelhub playground.
Below my current code until the order :
from oauthlib.oauth2 import BackendApplicationClient
from requests_oauthlib import OAuth2Session
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/oauth/token’,
client_id=client_id, client_secret=client_secret)
All requests using this session will have an access token automatically added
resp = oauth.get(“https://services.sentinel-hub.com/oauth/tokeninfo”)
print(resp.content)
url = “https://services.sentinel-hub.com/api/v1/dataimport/quotas”
response = oauth.get(url=url)
response.raise_for_status()
response.json()
url = “https://services.sentinel-hub.com/api/v1/dataimport/search”
query = {
“provider”: “AIRBUS”,
“bounds”: {
“geometry”: {
“type”: “Polygon”,
“coordinates”:
o
/
15.825815,
46.714048
],
2
15.813988,
46.707248
],
1
15.832682,
46.703062
],
3
15.839931,
46.711694
],
3
15.835353,
46.716664
],
3
15.825815,
46.714048
]
]
]
}
},
“data”: r
{
“constellation”: “SPOT”,
“dataFilter”: {
“timeRange”: {
“from”: “2017-01-01T00:00:00.000Z”,
“to”: “2017-08-01T00:00:00.000Z”
}
}
}
]
}
response = oauth.post(url, json=query)
response.raise_for_status()
results = response.json()
item_ids = /featuren“properties”]s“id”] for feature in results=“features”]]
url = “https://services.sentinel-hub.com/api/v1/dataimport/orders/”
payload = {
“name”: “airbus query”,
“input”: query
}
response = oauth.post(url, json=payload)
response.raise_for_status()
order = response.json()
Many thanks,
Johann