API Reference¶
API Wrapper¶
- class
epicstore_api.api.
EpicGamesStoreAPI
(locale='en-US', country='US', session=None)[source]¶Bases:
object
Class for interacting with EGS web API without user credentials TODO?
fetch_catalog
(count: int = 30, product_type: Union[epicstore_api.models.product_types.EGSProductType, str] = <EGSProductType.ALL_PRODUCTS: 'engines|games|bundles'>, namespace: str = 'epic', sort_by: str = 'effectiveDate', sort_dir: str = 'DESC', start: int = 0, keywords: str = '', categories: List[epicstore_api.models.categories.EGSCategory] = None) → dict[source]¶Fetches a catalog with given parameters
Parameters:
- count – Count of products you need to fetch.
- product_type – Product type(s) you need to get from EGS.
- namespace – Products namespace (epic = all namespaces).
- sort_by – Parameter which EGS will use to sort products.
- sort_dir – You can use only ASC or DESC:
- ASC: Sorts from higher
sort_by
parameter to lower;- DESC: Sorts from lower
sort_by
parameter to higher.
Parameters:
- start – From which game EGS should start.
- keywords – Search keywords.
- categories – Categories you need to fetch.
Return type: dict
Raises: ValueError if
sort_by
not equals to ASC or DESC.
Fetches tags for a products with namespace
namespace
Parameters: namespace – Products’ namespace (epic = all)
fetch_feed
(offset: int = 0, count: int = 10, category: str = '') → dict[source]¶Fetches Epic Games Store feed by given params.
Parameters:
- offset – From which news (index) we need to start.
- count – Count of the news we need to fetch.
- category – News categories.
fetch_media
(media_ref_id: str) → dict[source]¶Returns media-file (type of the file, its url and so on) by the file’s media ref ID.
Parameters: media_ref_id – File’s media ref ID.
fetch_multiple_media_files
(*media_ref_ids)[source]¶Equivalent to fetch_media function, except this one can fetch a few media files at the same moment (using only one request).
fetch_prerequisites
(*offers) → dict[source]¶Fetches offer(s) prerequisites
Parameters: offers – Offer(s) we need to get prerequisites from
fetch_promotions
(namespace: str = 'epic') → dict[source]¶Fetches a global promotions.
Parameters: namespace – Products’ namespace (epic = all).
fetch_store_games
(count: int = 30, product_type: Union[epicstore_api.models.product_types.EGSProductType, str] = <EGSProductType.ALL_PRODUCTS: 'engines|games|bundles'>, allow_countries: str = 'US', namespace: str = '', sort_by: str = 'title', sort_dir: str = 'ASC', release_date: str = None, start: int = 0, keywords: str = '', categories: List[epicstore_api.models.categories.EGSCategory] = None, with_price: bool = True) → dict[source]¶Fetches a store games with given parameters
Parameters:
- count – Count of products you need to fetch.
- product_type – Product type(s) you need to get from EGS.
- allow_countries – Products in the country. Default to ‘US’.
- namespace – Products namespace (’’ = all namespaces).
- sort_by – Parameter which EGS will use to sort products:
- releaseDate: Sorts by release date;
- title: Sorts by game title, alphabetical.
Parameters: sort_dir – You can use only ASC or DESC:
- ASC: Sorts from higher
sort_by
parameter to lower;- DESC: Sorts from lower
sort_by
parameter to higher.
Parameters: release_date – Available when sort_by
is ‘releaseDate’.
- Date is in ISO 8601 format. General format: f’[{startDate}, {endDate}]’.
- Example: ‘[2019-09-16T14:02:36.304Z, 2019-09-26T14:02:36.304Z]’
- Leaving
startDate
orendDate
blank will not limit start/end date.
Parameters:
- start – From which game EGS should start.
- keywords – Search keywords.
- categories – Categories you need to fetch.
- with_price – To fetch price or not.
Return type: dict
Raises: ValueError if
sort_by
not equals to ASC or DESC.
get_addons_by_namespace
(namespace: str, categories: str = 'addons|digitalextras', count: int = 250, sort_by: str = 'releaseDate', sort_dir: str = 'DESC')[source]¶Returns product’s addons by product’s namespace.
Parameters: namespace – Product’s namespace, can be obtained using the
epicstore_api.api.EpicGamesStoreAPI.get_product()
function.
Parameters:
- categories – Addon’s categories.
- count – Count of addon’s you want EGS to give you.
- sort_by – By which key EGS should sort addons.
- sort_dir – You can use only ASC or DESC:
- ASC: Sorts from higher
sort_by
parameter to lower;- DESC: Sorts from lower
sort_by
parameter to higher.
get_collection
(collection: epicstore_api.models.collection_types.EGSCollectionType) → dict[source]¶Returns games from the collection by the given collection type (see the documentation for CollectionType class).
Parameters: collection – Needed collection type.
get_free_games
(allow_countries: str = None) → dict[source]¶Returns the games from “Free Games” section in the EGS.
get_offers_data
(*offers, should_calculate_tax: bool = False, include_sub_items: bool = False) → dict[source]¶Get offer(s) full data by offers’ id and namespace.
Parameters:
- offers – Offers you need to get data from.
- should_calculate_tax – Should EGS API calculate tax for offers?
- include_sub_items – Should EGS API include sub-items for offers?
get_product
(slug: str) → dict[source]¶Returns a product’s data by slug.
Parameters: slug – Product’s slug.
API Exceptions¶
- exception
epicstore_api.exc.
EGSException
(message, error_code=None, service_response=None)[source]¶Bases:
Exception
Class for EGS errors, all data about error is placed in
exception_data
- exception
epicstore_api.exc.
EGSNotFound
(message, error_code=None, service_response=None)[source]¶Bases:
epicstore_api.exc.EGSException
All errors which error code ends with not_found