File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 11import requests
22
3- # Replace the following with the API key generated.
4- api_key = "API_KEY"
3+ # REPLACE the following with the API key you generated.
4+ API_KEY = "REPLACE_DEMO_API_KEY"
5+
56endpoint = "https://api.giphy.com/v1/gifs/trending"
6- params = {"api_key" : api_key , "limit" : 3 , "rating" : "g" }
77
8+ # In the query parameters you can define:
9+ # 1. The number of GIFs to return using the `limit` parameter.
10+ # 2. The accepted rating of the GIFs returned using the `rating` parameter: https://developers.giphy.com/docs/optional-settings#rating
11+ params = {"api_key" : API_KEY , "limit" : 3 , "rating" : "g" }
12+
13+ # The response will contain a list with all the GIFs that match your query.
14+ # For each of those, you want to get the `title`, `url` and the `trending_datetime` fields.
815response = requests .get (endpoint , params = params ).json ()
916for gif in response ["data" ]:
1017 title = gif ["title" ]
You can’t perform that action at this time.
0 commit comments