Skip to main content

An API wrapper for Epic Games Store with additional features (fork of epicstore_api)

Project description

epicstore_api_additions

Current pypi version Supported py versions Downloads

An unofficial library to work with Epic Games Store Web API. The library works with cloudscraper under the hood to battle the anti-bot protections, please be careful with the amount of requests you do, as this is not a silver bullet.

About This Fork

This is a customized fork of the original epicstore_api library with additional features and improvements:

  • Added get_store_config() method to retrieve store configuration for products by sandbox ID
  • Added get_product_by_id() method to retrieve product details by product ID
  • Added get_product_offer_by_id() method to retrieve offer details by product ID and offer ID
  • Implemented support for persisted GraphQL queries with hash caching mechanism
  • Added configurable hash endpoint for fetching GraphQL operation hashes
  • Enhanced performance with caching for sha256Hash values
  • Improved error handling and flexibility for API interactions

Installing

Python 3.7 or higher is required

To install the library you can just run the following command:

# Linux/macOS
python3 -m pip install -U epicstore_api_additions

# Windows
py -3 -m pip install -U epicstore_api_additions

Quick Example

api = EpicGamesStoreAPI()
namespace, slug = next(iter(api.get_product_mapping().items()))
first_product = api.get_product(slug)
offers = [
    OfferData(page['namespace'], page['offer']['id'])
    for page in first_product['pages']
    if page.get('offer') and 'id' in page['offer']
]
offers_data = api.get_offers_data(*offers)
for offer_data in offers_data:
    data = offer_data['data']['Catalog']['catalogOffer']
    developer_name = ''
    for custom_attribute in data['customAttributes']:
        if custom_attribute['key'] == 'developerName':
            developer_name = custom_attribute['value']
    print('Offer ID:', data['id'], '\nDeveloper Name:', developer_name)

New Feature: Get Store Configuration

from epicstore_api import EpicGamesStoreAPI

# Initialize API
api = EpicGamesStoreAPI(locale="zh-CN")

# Get store configuration for a product by sandbox ID
sandbox_id = "b4bb52a95d0b43d9af543c6ec3c54e04"  # Example sandbox ID
config = api.get_store_config(sandbox_id)
print(config)

New Feature: Get Product by ID

from epicstore_api import EpicGamesStoreAPI

# Initialize API
api = EpicGamesStoreAPI(locale="zh-CN", country="TW")

# Get product details by product ID
product_id = "3ac65ef5cdf44b8084fcac818002635f"  # Example product ID
product = api.get_product_by_id(product_id)
print(product)

New Feature: Get Product Offer by ID

from epicstore_api import EpicGamesStoreAPI

# Initialize API
api = EpicGamesStoreAPI(locale="zh-CN", country="TW")

# Get offer details by product ID and offer ID
product_id = "3ac65ef5cdf44b8084fcac818002635f"  # Example product ID
offer_id = "cb49140c3c11429589ab22fd75c41504"  # Example offer ID
offer = api.get_product_offer_by_id(product_id, offer_id)
print(offer)

You can find more examples in the examples directory.

Contributing

Feel free to contribute by creating PRs and sending your issues

Links

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

epicstore_api_additions-0.2.1.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

epicstore_api_additions-0.2.1-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file epicstore_api_additions-0.2.1.tar.gz.

File metadata

  • Download URL: epicstore_api_additions-0.2.1.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for epicstore_api_additions-0.2.1.tar.gz
Algorithm Hash digest
SHA256 5b02e6e8b6f1d4dd6687cd1ac6baba65058a011d9cbf030ac878d1cd61900205
MD5 202e639ec83c8b83de33f69eded2b76f
BLAKE2b-256 391a2a15b29f58fd6fdf5fe3afc2b93f2fac095d4222d7f83410acd5f0531922

See more details on using hashes here.

File details

Details for the file epicstore_api_additions-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for epicstore_api_additions-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8bcac086c2e3dff58b904e9d97280b2223c251d2f0d0d7c8ee9461773f9e1b3d
MD5 2f09280e2bc1e58dec6a16f565cf76ab
BLAKE2b-256 dfcee67b9693423ee32eb078c16233e4102e3b2d36a2c8cbcbd71a8477a15766

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page