Spaces:
Sleeping
Sleeping
:ambulance: some tests
Browse files32 unmodified lines33343536373839404142434432 unmodified lines# Send the GET request to the APIresponse = requests.get(url)# Check if the request was successfulif response.status_code == 200:# Extract the URLs of the images from the response JSONdata = response.json() # Parse the response as JSONimage_urls = [item['url'] for item in data] # Extract URLs for all imagesreturn image_urlselse:return f"Failed to fetch data. Status code: {response.status_code}"32 unmodified lines33343536373839404142434445464748495032 unmodified lines# Send the GET request to the APIresponse = requests.get(url)print(limit)print(response)# Check if the request was successfulif response.status_code == 200:# Extract the URLs of the images from the response JSONdata = response.json() # Parse the response as JSONimage_urls = [item['url'] for item in data] # Extract URLs for all imagesprint()print("=========\n\n")print(image_urls)print("=========\n\n")return image_urlselse:return f"Failed to fetch data. Status code: {response.status_code}"
app.py+6