ReverseSearch¶
Core Class¶
-
class
retaggr.
ReverseSearch
(config, test_mode=False)[source]¶ Core class used for Reverse Searching.
This class can only be instantiated with a
ReverseSearchConfig
instance.All listed methods can only be ran from an asynchronous context.
Variables: accessible_engines – The accessible boorus from the passed in configuration object.
Parameters: - config (ReverseSearchConfig) – The config object.
- test_mode (bool) – Enable test mode. Test mode adds two dummy engines that can fail as well as return some very basic values.
-
reverse_search
(url, callback=None, download=False)[source]¶ Reverse searches all accessible boorus for
url
.Note
Callback is a callback function that can be passed in. This can be used to keep track of progress for certain methods and functions.
1 2 3 4 5 6 7 8
async def callback(engine, rresult): print("This booru was searched: %s", booru) print("These tags were found: %s", rresult.tags) print("This source was found: %s", rresult.source) print("This rating was found: %s", rresult.rating) # Callback will be called each time a search finishes. rs.reverse_search(url, callback)
After a reverse search, this method will be called with the engine name that was just searched.
Parameters: Returns: A
ReverseResult
instance containing your data.Return type:
-
search_image
(booru, url)[source]¶ Reverse search a booru for
url
.Parameters: Raises: - MissingAPIKeysException – Required keys in config object missing.
- NotAValidEngineException – The passed in booru is not a valid booru.
Returns: A
ImageResult
instance containing your data.Return type: