Skip to content

Instantly share code, notes, and snippets.

@Lerking
Last active September 6, 2021 09:38
Show Gist options
  • Select an option

  • Save Lerking/04defb09a017f43c9b8d4fdb77cb37b6 to your computer and use it in GitHub Desktop.

Select an option

Save Lerking/04defb09a017f43c9b8d4fdb77cb37b6 to your computer and use it in GitHub Desktop.

Revisions

  1. Lerking revised this gist Sep 6, 2021. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions wakatime_cfg_api_key.py
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,3 @@
    #Reading api_key from wakatime.cfg on Linux

    from pathlib import Path
    import configparser

  2. Lerking created this gist Sep 6, 2021.
    12 changes: 12 additions & 0 deletions wakatime_cfg_api_key.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    #Reading api_key from wakatime.cfg on Linux

    from pathlib import Path
    import configparser

    home = str(Path.home())
    config = configparser.RawConfigParser()

    with open(home + "/.wakatime.cfg", "r") as cfgfile:
    config.read_file(cfgfile)

    print(config.get("settings", "api_key"))