giphypop.py
def translate(self, term=None, phrase=None, strict=False, rating=None):
        """
        Retrieve a single image that represents a transalation of a term or
        phrase into an animated gif. Punctuation is ignored. By default, this
        will perform a `term` translation. If you want to translate by phrase,
        use the `phrase` keyword argument.

        :param term: Search term or terms
        :type term: string
        :param phrase: Search phrase
        :type phrase: string
        :param strict: Whether an exception should be raised when no results
        :type strict: boolean
        :param rating: limit results to those rated (y,g, pg, pg-13 or r).
        :type rating: string
        """
        assert any((term, phrase)), 'You must supply a term or phrase to search'

        # Phrases should have dashes and not spaces
        if phrase:
            phrase = phrase.replace(' ', '-')

        params = {'s': (term or phrase)}
        if rating:
            params.update({'rating': rating})
        resp = self._fetch('translate', **params)
        if resp['data']:
            return GiphyImage(resp['data'])
        elif strict or self.strict:
            raise GiphyApiException(
                "Term/Phrase '%s' could not be translated into a GIF" %
                (term or phrase))
def translate(self, term=None, phrase=None, strict=False, rating=None):
        assert any((term, phrase)), 'You must supply a term or phrase to search'

        # Phrases should have dashes and not spaces
        if phrase:
            phrase = phrase.replace(' ', '-')

        params = {'s': (term or phrase)}
        if rating:
            params.update({'rating': rating})
        resp = self._fetch('translate', **params)
        if resp['data']:
            return GiphyImage(resp['data'])
        elif strict or self.strict:
            raise GiphyApiException(
                "Term/Phrase '%s' could not be translated into a GIF" %
                (term or phrase))
def translate ( self , term = None , phrase = None , strict = False , rating = None ) : assert any ( ( term , phrase ) ) , 'You must supply a term or phrase to search' # Phrases should have dashes and not spaces if phrase : phrase = phrase . replace ( ' ' , '-' ) params = { 's' : ( term or phrase ) } if rating : params . update ( { 'rating' : rating } ) resp = self . _fetch ( 'translate' , * * params ) if resp [ 'data' ] : return GiphyImage ( resp [ 'data' ] ) elif strict or self . strict : raise GiphyApiException ( "Term/Phrase '%s' could not be translated into a GIF" % ( term or phrase ) )
Retrieve a single image that represents a transalation of a term or
        phrase into an animated gif. Punctuation is ignored. By default, this
        will perform a `term` translation. If you want to translate by phrase,
        use the `phrase` keyword argument.

        :param term: Search term or terms
        :type term: string
        :param phrase: Search phrase
        :type phrase: string
        :param strict: Whether an exception should be raised when no results
        :type strict: boolean
        :param rating: limit results to those rated (y,g, pg, pg-13 or r).
        :type rating: string
Retrieve a single image that represents a transalation of a term or phrase into an animated gif . Punctuation is ignored . By default this will perform a term translation . If you want to translate by phrase use the phrase keyword argument .