Spaces:
Sleeping
Sleeping
import requests | |
def fetch_high_quality_images(api_key, query, per_page=80): | |
url = "https://api.pexels.com/v1/search" | |
headers = { | |
"Authorization": api_key | |
} | |
params = { | |
"query": query, | |
"per_page": per_page, | |
"size": "large" | |
} | |
response = requests.get(url, headers=headers, params=params) | |
if response.status_code == 200: | |
images = response.json()['photos'] | |
for image in images: | |
print(image['src']['original']) | |
else: | |
print("Error:", response.status_code) | |
if __name__ == "__main__": | |
api_key = "5woz23MGx1QrSY0WHFb0BRi29JvbXPu97Hg0xnklYgHUI8G0w23FKH62" # ์ฌ๊ธฐ์ Pexels API ํค๋ฅผ ์ ๋ ฅํ์ธ์. | |
query = input("๊ฒ์ํ ์ด๋ฏธ์ง์ ํค์๋๋ฅผ ์ ๋ ฅํ์ธ์: ") | |
fetch_high_quality_images(api_key, query) |