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 gfycat : Gfycat
var vreddit : Vreddit
var imgur : Imgur
var youtube : Youtube
var generic : Generic
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.