Skip to content

Instantly share code, notes, and snippets.

@woctezuma
Last active January 9, 2022 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woctezuma/9a2bb9c09d4cf86996bb814e9c10c15f to your computer and use it in GitHub Desktop.
Save woctezuma/9a2bb9c09d4cf86996bb814e9c10c15f to your computer and use it in GitHub Desktop.
Query Epic Games Store with Legendary
# 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()
@woctezuma
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment