Spaces:
Sleeping
Sleeping
File size: 818 Bytes
0c4b9a7 ec5aa0b 0c4b9a7 89ea00c 0c4b9a7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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) |