tenor package¶
Submodules¶
tenor.client module¶
- class tenor.client.TenorClient(*, api_key: str, session: Optional[aiohttp.client.ClientSession] = None, loop: Optional[asyncio.events.AbstractEventLoop] = None)[source]¶
Bases:
object- async search(query: str, *, locale: Optional[str] = None, content_filter: Optional[tenor.types.ContentFilter] = 'off', media_filter: Optional[tenor.types.MediaFilter] = None, ar_range: Optional[tenor.types.AspectRatio] = None, limit: Optional[int] = None, pos: Optional[int] = None, anon_id: Optional[str] = None) → tenor.models.TenorResponse[source]¶
Searches tenor with the provided query.
- Parameters
query (str) – The query used to search Tenor
locale (Optional[str], optional) – The locale. Usually in the format of xx_YY, defaults to None
content_filter (Optional[ContentFilter], optional) – The strength of the content filter, defaults to “off”
media_filter (Optional[MediaFilter], optional) – The type of Media Filter used. This filters the types of media returned, defaults to None
ar_range (Optional[AspectRatio], optional) – Aspect Ratio range. Limits the size of media returned, defaults to None
limit (Optional[int], optional) – Limits how many results you get returned, defaults to None
pos (Sets a starting value to search from, optional) – [description], defaults to None
anon_id (Optional[str], optional) – Specify the anonymous_id tied to the given user, defaults to None
- Returns
Returns a TenorResponse object. Holds the media returned to us.
- Return type
- async trending(*, locale: Optional[str] = None, content_filter: Optional[tenor.types.ContentFilter] = 'off', media_filter: Optional[tenor.types.MediaFilter] = None, ar_range: Optional[tenor.types.AspectRatio] = None, limit: Optional[int] = None, pos: Optional[int] = None, anon_id: Optional[str] = None) → tenor.models.TenorResponse[source]¶
Fetches currently trending media on Tenor
- Parameters
locale (Optional[str], optional) – The locale. Usually in the format of xx_YY, defaults to None
content_filter (Optional[ContentFilter], optional) – The strength of the content filter, defaults to “off”
media_filter (Optional[MediaFilter], optional) – The type of Media Filter used. This filters the types of media returned, defaults to None
ar_range (Optional[AspectRatio], optional) – Aspect Ratio range. Limits the size of media returned, defaults to None
limit (Optional[int], optional) – Limits how many results you get returned, defaults to None
pos (Sets a starting value to search from, optional) – [description], defaults to None
anon_id (Optional[str], optional) – Specify the anonymous_id tied to the given user, defaults to None
- Returns
Returns a TenorResponse object. Holds the media returned to us.
- Return type
tenor.http module¶
- class tenor.http.HTTPClient(*, api_key: Optional[str] = None, session: Optional[aiohttp.client.ClientSession] = None)[source]¶
Bases:
object- async request(route: tenor.http.Route) → dict[source]¶
- class tenor.http.Route(endpoint: str, params: dict, method: str = 'GET', **kwargs)[source]¶
Bases:
object- BASE = 'https://g.tenor.com/v1'¶
tenor.models module¶
- class tenor.models.GIF(*, data: dict)[source]¶
Bases:
object- property dimensions: List[int]¶
Returns a List of integers representing x and y properties
- Returns
A List of integers.
- Return type
List[int]
- property preview_url: str¶
Returns a preview_url. This is usually of a png file type.
- Returns
A preview_url.
- Return type
str
- property size: int¶
Returns an integer representing the size of the GIF.
- Returns
An integer representing the size of the GIF.
- Return type
int
- property url: str¶
Returns the real url of the GIF.
- Returns
The url of our GIF
- Return type
str
- class tenor.models.LoopedMP4(*, data: dict)[source]¶
Bases:
tenor.models.MP4
- class tenor.models.MP4(*, data: dict)[source]¶
Bases:
object- property dimensions: List[int]¶
Returns a List of integers representing x and y properties
- Returns
A List of integers.
- Return type
List[int]
- property duration: Union[float, int]¶
Returns either a float or an integer representing how long the MP4 is in milliseconds.
- Returns
A float or an integer representing how long the MP4 is in milliseconds.
- Return type
Union[float, int]
- property preview_url: str¶
Returns a preview_url. This is usually of a png file type.
- Returns
A preview_url.
- Return type
str
- property size: int¶
Returns an integer representing the size of the MP4.
- Returns
An integer representing the size of the MP4.
- Return type
int
- property url: str¶
Returns the real url of the MP4.
- Returns
The url of our MP4
- Return type
str
- class tenor.models.Media(*, data: dict, raw_object: dict)[source]¶
Bases:
object- property gif: Optional[tenor.models.GIF]¶
Returns a GIF object. Contains Media Properties.
- Returns
Returns a GIF object.
- Return type
Optional[GIF]
- property item_url: str¶
Returns a url that links to the official Tenor Page to the GIF.
- Returns
A string containing a URL.
- Return type
str
- property looped_mp4: Optional[tenor.models.LoopedMP4]¶
Returns a LoopedMP4 object. Contains Media Properties.
- Returns
Returns a LoopedMP4 object. Subclasses MP4.
- Return type
Optional[LoopedMP4]
- property medium_gif: Optional[tenor.models.MediumGIF]¶
Returns a MediumGIF object. Contains Media Properties.
- Returns
Returns a MediumGIF object. Subclasses GIF.
- Return type
Optional[MediumGIF]
- property mp4: Optional[tenor.models.MP4]¶
Returns a MP4 object. Contains Media Properties.
- Returns
Returns a MP4 object.
- Return type
Optional[MP4]
- property nano_gif: Optional[tenor.models.NanoGIF]¶
Returns a NanoGIF object. Contains Media Properties.
- Returns
Returns a NanoGIF object. Subclasses GIF.
- Return type
Optional[NanoGIF]
- property nano_mp4: Optional[tenor.models.NanoMP4]¶
Returns a NanoMP4 object. Contains Media Properties.
- Returns
Returns a NanoMP4 object. Subclasses MP4.
- Return type
Optional[NanoMP4]
- property tiny_gif: Optional[tenor.models.TinyGIF]¶
Returns a TinyGIF object. Contains Media Properties.
- Returns
Returns a TinyGIF object. Subclasses GIF.
- Return type
Optional[TinyGIF]
- property tiny_mp4: Optional[tenor.models.TinyMP4]¶
Returns a TinyMP4 object. Contains Media Properties.
- Returns
Returns a TinyMP4 object. Subclasses MP4.
- Return type
Optional[TinyMP4]
- property tiny_webm: Optional[tenor.models.TinyWebM]¶
Returns a TinyWebM object. Contains Media Properties.
- Returns
Returns a TinyWebM object. Subclasses WebM.
- Return type
Optional[TinyWebM]
- property url: str¶
Returns a quick access url for the Media object. Usually a GIF file type.
- Returns
A string containing a URL.
- Return type
str
- class tenor.models.MediumGIF(*, data: dict)[source]¶
Bases:
tenor.models.GIF
- class tenor.models.NanoGIF(*, data: dict)[source]¶
Bases:
tenor.models.GIF
- class tenor.models.NanoMP4(*, data: dict)[source]¶
Bases:
tenor.models.MP4
- class tenor.models.TenorResponse(*, data: dict)[source]¶
Bases:
object- property media: List[Optional[tenor.models.Media]]¶
Generates the media objects and returns them in a list.
- Returns
A list of Media objects.
- Return type
Optional[List[Media]]
- property raw: dict¶
Returns the raw json payload received from the Tenor API.
- Returns
The raw json payload fetched from the Tenor API.
- Return type
dict
- class tenor.models.TinyGIF(*, data: dict)[source]¶
Bases:
tenor.models.GIF
- class tenor.models.TinyMP4(*, data: dict)[source]¶
Bases:
tenor.models.MP4
- class tenor.models.TinyWebM(*, data: dict)[source]¶
Bases:
tenor.models.WebM
- class tenor.models.WebM(*, data: dict)[source]¶
Bases:
tenor.models.GIF