Gif API in python

0

It is my question and the following I have this script where I type the name of the gif that I want and it returns me several type of url of the size (width, height) of the randomly drawn gif, I wanted it to return me only this:

  

image_url ':   ' link ',   which in the case would be the largest image he has.

How do I do this?

  

script taken: link

import time
import giphy_client
from giphy_client.rest import ApiException
from pprint import pprint


api_instance = giphy_client.DefaultApi()
api_key = 'dc6zaTOxFJmzC' 
tag = input('Nome do gif : ') 
rating = 'g' 
fmt = 'json' 

try: 
    # Random Endpoint
    api_response = api_instance.gifs_random_get(api_key, tag=tag, rating=rating, fmt=fmt)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->gifs_random_get: %s\n" % e)
    
asked by anonymous 01.05.2018 / 19:18

1 answer

-1

Try this:

...
pprint(api_response.data.image_url)
...
    
02.05.2018 / 00:14