rawg¶
The main rawg class
-
class
rawgpy.rawg.
RAWG
(user_agent)[source]¶ main RAWG class
the main class used for interactions with the RAWG.io database
-
collection_games
(slug)[source]¶ generator that yields the collections games json
Parameters: slug (str) – the slug of the collection Returns: generator of the games json Return type: pagination_generator
-
collection_request
(slug) → dict[source]¶ Returns the collection json
Parameters: slug (str) – the collection slug Returns: The collection json Return type: dict
-
create_collection
(name, description) → rawgpy.collection.Collection[source]¶ creates a new collection
Parameters: Returns: Collection object of created collection
Return type:
-
current_user
() → rawgpy.user.User[source]¶ Returns the currently authenticated user
Returns: The currently authenticated user Return type: User
-
current_user_request
() → dict[source]¶ Returns the currently authenticated user json
Returns: Json of the authenticated user Return type: dict
-
game_collections
(game_slug)[source]¶ Retrieve the collections a game is a part of
Parameters: game_slug (str.) – the slug of the game Returns: generator of the collections json Return type: pagination_generator
-
game_request
(slug, additional_param='') → dict[source]¶ uses the
get_request
method to get a specific games jsonParameters: - slug (str) – the slug of the game that shoudl be returned, needs to be correct rawg slug
- additional_param – any additional request parameter
Returns: json-like list / dict structure of the returned json
Return type:
-
game_suggestions
(slug)[source]¶ generator that yields the suggested games for a game
Parameters: slug (str) – the game slug Returns: generator of the games json Return type: pagination_generator
-
get_collection
(slug) → rawgpy.collection.Collection[source]¶ Returns the collection object
Parameters: slug (str) – the collection slug Returns: The collection object Return type: Collection
-
get_game
(slug) → rawgpy.game.Game[source]¶ get a specific game
Parameters: slug (str) – the slug of the game Returns: the game object Return type: Game
-
get_request
(url) → dict[source]¶ Sends a GET request
Parameters: url (str) – the url it sends a request to, Returns: json-like list / dict structure of the returned json Return type: dict
-
get_user
(slug) → rawgpy.user.User[source]¶ gets a user
User
Parameters: slug (str) – the userslug Returns: user json Return type: dict Returns: generator of the collections json Return type: User
-
login
(email, password)[source]¶ Logs the user in, autheticating all subsequent requests with that user
Parameters:
-
pagination_generator
(url, results_name='results', next_name='next') → dict[source]¶ Generator for pagination based urls, reads the value of next_name from the json to get the url for the next request
uses
get_request
Parameters: Returns: the paginated objects json
Return type:
-
patch_game
(slug, data)[source]¶ Patch (edit) a game
Parameters: Returns: The response json
Return type:
-
patch_request
(url, data) → dict[source]¶ Sends a PATCH request
Parameters: Returns: The response json
Return type:
-
review_data
(level, reactions=None, add_to_library=False, text='', post_twitter=False, post_facebook=False) → dict[source]¶ creates the data for review operations
Parameters: - game_id (int) – the int id of the game
- level (int) – 1 = skip, 3 = meh, 4 = Recommended, 5 = Exceptional
- reactions (List[int], optional) – List of the reactions to add, defaults to None
- add_to_library (bool, optional) – whether the game whouls be added to the authenticated users library, defaults to False
- text (str, optional) – the review text, uses html formats like <br>, defaults to “”
- post_twitter (bool, optional) – whether to post on twitter, defaults to False
- post_facebook (bool, optional) – whether to post on facebook, defaults to False
Returns: The data that has been made
Return type:
-
review_game
(game_id: int, level, reactions=None, add_to_library=False, text='', post_twitter=False, post_facebook=False)[source]¶ Adds a review to a game
Parameters: - game_id (int) – the int id of the game
- level (int) – 1 = skip, 3 = meh, 4 = Recommended, 5 = Exceptional
- reactions (List[int], optional) – List of the reactions to add, defaults to None
- add_to_library (bool, optional) – whether the game whouls be added to the authenticated users library, defaults to False
- text (str, optional) – the review text, uses html formats like <br>, defaults to “”
- post_twitter (bool, optional) – whether to post on twitter, defaults to False
- post_facebook (bool, optional) – whether to post on facebook, defaults to False
-
search
(query, num_results=5, additional_param='') → rawgpy.game.Game[source]¶ searches for games
Parameters:
-
search_request
(query, num_results=5, additional_param='') → dict[source]¶ uses the
get_request
method to search for a gameParameters: Returns: json-like list / dict structure of the returned json
Return type:
-