You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pystac_client.exceptions.apierror: the request exceeded the maximum allowed time, please try again. if the issue persists, please contact planetarycomputer@microsoft.com. #382
@mmcfarland deployed a change that seems to have resolved things. We'll keep monitoring it, but do let us know if you continue to see these errors.
@mmcfarland deployed a change that seems to have resolved things. We'll keep monitoring it, but do let us know if you continue to see these errors.
import json
import pystac_client
import planetary_computer
from pystac_client import Client, Modifiable
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST
from django.http import JsonResponse
from urllib.parse import urlparse
@csrf_exempt
@require_POST
def search_NDVI(request):
if request.method == 'POST':
start_date = request.POST.get('start_date')
end_date = request.POST.get('end_date')
cloud_cover = request.POST.get('cloud_cover')
time_of_interest = f'{start_date}/{end_date}'
geojson_str = request.POST.get('geojson')
if not geojson_str or not start_date or not end_date:
return JsonResponse(status=400)
try:
geojson = json.loads(geojson_str)
except json.JSONDecodeError:
return JsonResponse({'error': 'geosonerror'}, status=400)
if 'features' not in geojson or not geojson['features']:
return JsonResponse({'error': 'GeoJSONerror'}, status=400)
area_of_interest = geojson['features'][0]['geometry']
catalog = pystac_client.Client.open(
"https://planetarycomputer.microsoft.com/api/stac/v1",
modifier=planetary_computer.sign_inplace,
)
search = catalog.search(
collections=["sentinel-2-l2a"],
intersects=area_of_interest,
datetime=time_of_interest,
query={"eo:cloud_cover": {"lt": cloud_cover}},
)
items = list(search.get_items())
if not items:
return JsonResponse({'message': 'no image'}, status=200)
item_details = []
for item in items:
item_link = item.assets["visual"].href
parsed_url = urlparse(item_link)
filename = parsed_url.path.split('/')[-1]
filename_without_ext = filename.split('.')[0]
cloud_cover = item.properties['eo:cloud_cover']
item_details.append({
'Image ID':item.id,
'Product parameters': filename_without_ext,
'Shooting date': str(item.datetime.date()),
'Cloud cover': cloud_cover,
})
return JsonResponse({'message': 'successful', 'Data information': item_details})
return JsonResponse({'error': 'POST'}, status=405)
I also encountered the same problem when I integrated the functionality into Django
Wrong content:pystac_client.exceptions.apierror: the request exceeded the maximum allowed time, please try again. if the issue persists, please contact planetarycomputer@microsoft.com.
Activity
777arc commentedon Oct 18, 2024
Around the time you posted this issue we had a service degradation, mind checking again now that it's back up?
777arc commentedon Oct 20, 2024
Pretty sure this was due to the outage, closing, re-open if you find it is still happening
Ethan-Chen421 commentedon Oct 20, 2024
Thank you for your reply. Yesterday, the service was accessible normally, but today it is intermittent.
777arc commentedon Oct 21, 2024
Hmm ok, can you elaborate on the intermittent aspect, eg what calls are being slow and how slow
Ethan-Chen421 commentedon Oct 22, 2024
Hello, I visited today and the service has been restored quickly. Thank you very much for your reply