Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- def get_sports():
- # Make API request to retrieve sports data
- api_url = "https://www.thesportsdb.com/api/v1/json/########/all_sports.php"
- response = requests.get(api_url)
- data = response.json()
- image_urls = []
- # Process the retrieved data and collect the image URLs
- for sport in data['sports']:
- if 'strSportThumb' in sport:
- image_urls.append(sport['strSportThumb'])
- return image_urls
- # Get the list of image URLs
- image_urls = get_sports()
- # Print the image URLs for testing
- for url in image_urls:
- print(f"Image: {url}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement