Module pyreddit.services.services_wrapper

Entrypoint of the whole services pattern.

Classes

class ServicesWrapper

Entrypoint of the whole services pattern.

It represents a Facade which hides the complexity of the media retrieval across various services and providers.

An instance for each service class is set at class initialization.

Class variables

var gfycatGfycat
var vredditVreddit
var imgurImgur
var youtubeYoutube
var genericGeneric

Static methods

def init_services()

Construct services objects and initialize authentication.

Note

This needs to be called after having loaded the secret in the configuration.

def get_media(url: str, data: Any = None) ‑> Media

Given the url from the Reddit json, return the corresponding media obj.

Main function with the responsibility to choose the right service.

Parameters

url : str
Url from Reddit API json.
data : json

(Default value = {})

Reddit data json containing media fallback urls.

Returns

Media The media object corresponding to the media post url.