giphy package

Submodules

giphy.client module

class giphy.client.GiphyClient(*, api_key: str, session: Optional[aiohttp.client.ClientSession] = None, loop: Optional[asyncio.events.AbstractEventLoop] = None)[source]

Bases: object

async connect()[source]

Opens the aiohttp.ClientSession(), thus allowing connections to the Giphy API

open()[source]

Called in __init__. Opens the aiohttp.ClientSession()

async search(query: str, *, limit: Optional[int] = 25, offset: Optional[int] = 0, rating: Optional[giphy.types.AgeRating] = None, language: Optional[str] = None, user_proxy: Optional[str] = None)giphy.models.GiphyResponse[source]

Searches the Giphy API.

Parameters
  • query (str) – Search query term or phrase.

  • limit (Optional[int], optional) – The maximum number of objects to return, defaults to 25

  • offset (Optional[int], optional) – The maximum number of objects to return, defaults to 0

  • rating (Optional[AgeRating], optional) – Filters results by specified rating, defaults to None

  • language (Optional[str], optional) – Specify default language for regional content, defaults to None

  • user_proxy (Optional[str], optional) – An ID/proxy for a specific user, defaults to None

Returns

A GiphyResponse object. Holds properties such as .media and .meta.

Return type

GiphyResponse

async trending(*, limit: Optional[int] = 25, offset: Optional[int] = 0, rating: Optional[giphy.types.AgeRating] = None, language: Optional[str] = None, user_proxy: Optional[str] = None)giphy.models.GiphyResponse[source]

Fetches the trending GIF’s from Giphy.

Parameters
  • limit (Optional[int], optional) – The maximum number of objects to return, defaults to 25

  • offset (Optional[int], optional) – The maximum number of objects to return, defaults to 0

  • rating (Optional[AgeRating], optional) – Filters results by specified rating, defaults to None

  • language (Optional[str], optional) – Specify default language for regional content, defaults to None

  • user_proxy (Optional[str], optional) – An ID/proxy for a specific user, defaults to None

Returns

A GiphyResponse object. Holds properties such as .media and .meta.

Return type

GiphyResponse

giphy.http module

class giphy.http.HTTPClient(*, api_key: Optional[str] = None, session: Optional[aiohttp.client.ClientSession] = None)[source]

Bases: object

async cleanup()[source]
async open_session()[source]
async request(route: giphy.http.Route)dict[source]
class giphy.http.Route(endpoint: str, params: dict, method: str = 'GET', **kwargs)[source]

Bases: object

BASE = 'https://api.giphy.com/v1'

giphy.models module

class giphy.models.GiphyResponse(*, raw_payload: dict)[source]

Bases: object

property media: List[giphy.models.Media]

Returns a list of Media Objects.

Returns

A list of Media Objects containing properties such as .url

Return type

List[Media]

property meta: giphy.models.Meta

Returns the Meta object.

Returns

Meta Object - Holds request information.

Return type

Meta

class giphy.models.Media(*, data: dict)[source]

Bases: object

property bitly_gif_url: str

Returns the bitly_gif_url property of the Media Object returned.

Return type

str

property bitly_url: str

Returns the bitly_url of the Media Object returned.

Return type

str

property embed_url: str

properties.

Return type

str

Type

Returns the embed_url. This url has embed og

property id: str

SyBtFOwyGO4JW

Return type

str

Type

Returns the id of the Media Object. Example

property rating: str

Returns the age rating of the Media Object.

Return type

str

property slug: str

Returns the slug of a Giphy URL. This is usually the suffix of a Giphy view page.

Return type

str

property title: str

Returns the title of the Media Object. Usually the name of the object.

Return type

str

property type: str

GIF (gif).

Return type

str

Type

Returns the type of Media. Example

property url: str

Returns the URL of the Media Object.

Return type

str

class giphy.models.Meta(*, payload: dict)[source]

Bases: object

property message: str

Returns the message linked to the status of the request.

Return type

str

property msg: str

Alias for message.

Return type

str

property response_id: str

Returns the response_id of the request.

Return type

str

property status: int

Returns the status code of the request.

Return type

int

giphy.types module

class giphy.types.AgeRating[source]

Bases: object

View all the age ratings at: https://developers.giphy.com/docs/optional-settings/#rating

static g()[source]

Specifies the G rating: Completely clean content.

static pg()[source]

Specifies the PG rating: Mild sexual content, Mild Profanities etc.

static pg_13()[source]

Specifies the PG-13 rating: Moderate Profanities. Moderate sexual content etc.

static r()[source]

Specifies the R rating: Severe Profanities. Severe sexual themes and content.

Module contents