How to use the osrsbox.prayers_api.all_prayers function in osrsbox

To help you get started, we’ve selected a few osrsbox examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github osrsbox / osrsbox-db / scripts / update / update_json_files.py View on Github external
def generate_prayers_complete():
    """Generate the `docs/prayers-complete.json` file."""
    # Read in the item database content
    path_to_prayers_json = Path(config.DOCS_PATH / "prayers-json")
    all_db_prayers = prayers_api.all_prayers.AllPrayers(path_to_prayers_json)

    prayers = {}

    for prayer in all_db_prayers:
        json_out = prayer.construct_json()
        prayers[prayer.id] = json_out

    # Save all prayers to docs/prayers-complete.json
    out_fi = Path(config.DOCS_PATH / "prayers-complete.json")
    with open(out_fi, "w") as f:
        json.dump(prayers, f)

    # Save all prayers to osrsbox/docs/prayers-complete.json
    out_fi = Path(config.PACKAGE_PATH / "docs" / "prayers-complete.json")
    with open(out_fi, "w") as f:
        json.dump(prayers, f)