MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / get_gifs

Function get_gifs

web_programming/giphy.py:16–23  ·  view source on GitHub ↗

Get a list of URLs of GIFs based on a given query..

(query: str, api_key: str = giphy_api_key)

Source from the content-addressed store, hash-verified

14
15
16def get_gifs(query: str, api_key: str = giphy_api_key) -> list:
17 """
18 Get a list of URLs of GIFs based on a given query..
19 """
20 formatted_query = "+".join(query.split())
21 url = f"https://api.giphy.com/v1/gifs/search?q={formatted_query}&api_key={api_key}"
22 gifs = httpx.get(url, timeout=10).json()["data"]
23 return [gif["url"] for gif in gifs]
24
25
26if __name__ == "__main__":

Callers 1

giphy.pyFile · 0.85

Calls 3

splitMethod · 0.80
jsonMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected