Last active
January 9, 2022 16:17
-
-
Save woctezuma/9a2bb9c09d4cf86996bb814e9c10c15f to your computer and use it in GitHub Desktop.
Query Epic Games Store with Legendary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. Get Legendary: | |
# > git clone https://github.com/derrod/legendary.git | |
# > cd legendary/ | |
# > pip install -r requirements.txt | |
# 2. Fill-in your **private** access token instead of the dummy token `eg1~MY_SECRET_TOKEN`. | |
# 3. Run this script. | |
import json | |
import legendary.api.egs as egs | |
def get_secret_token(): | |
token = "eg1~MY_SECRET_TOKEN" # TODO | |
return token | |
def save_json(data, fname): | |
with open(fname, "w", encoding="utf8") as f: | |
json.dump(data, f) | |
return | |
def main(): | |
api = egs.EPCAPI() | |
api.session.headers["Authorization"] = f"bearer {get_secret_token()}" | |
save_json(data=api.get_library_items(), fname="library_items.json") | |
save_json(data=api.get_game_assets(), fname="game_assets.json") | |
return | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Postman requests: https://github.com/woctezuma/egs-15DaysofGames/wiki/Postman