Added .env.example file

Fixes #293
This commit is contained in:
anmol098
2022-06-12 14:56:47 +05:30
parent 9970f82505
commit 0b02c08661
2 changed files with 59 additions and 49 deletions

15
.env.example Normal file
View File

@@ -0,0 +1,15 @@
INPUT_WAKATIME_API_KEY=""
INPUT_SHOW_TIMEZONE="True"
INPUT_SHOW_PROJECTS="False"
INPUT_SHOW_EDITORS="False"
INPUT_SHOW_OS="False"
INPUT_SHOW_LANGUAGE="False"
INPUT_GH_TOKEN=""
INPUT_SYMBOL_VERSION="1"
INPUT_SHOW_LINES_OF_CODE="False"
INPUT_SHOW_LOC_CHART="False"
INPUT_SHOW_PROFILE_VIEWS="False"
INPUT_SHOW_TOTAL_CODE_TIME="True"
INPUT_SHOW_SHORT_INFO="False"
INPUT_SHOW_COMMIT="False"
INPUT_SHOW_DAYS_OF_WEEK="True"

19
main.py
View File

@@ -328,21 +328,20 @@ def get_waka_time_stats():
if request.status_code == 401:
print("Error With WAKA time API returned " + str(request.status_code) + " Response " + str(request.json()))
else:
empty = True
data = request.json()
if showCommit.lower() in truthy:
empty = False
stats = stats + generate_commit_list(tz=data['data']['timezone']) + '\n\n'
if showTimeZone.lower() in truthy or showLanguage.lower() in truthy or showEditors.lower() in truthy or \
showProjects.lower() in truthy or showOs.lower() in truthy:
stats += '📊 **' + translate['This Week I Spend My Time On'] + '** \n\n'
stats += '```text\n'
if showTimeZone.lower() in truthy:
empty = False
tzone = data['data']['timezone']
stats = stats + '⌚︎ ' + translate['Timezone'] + ': ' + tzone + '\n\n'
if showLanguage.lower() in truthy:
empty = False
if len(data['data']['languages']) == 0:
lang_list = no_activity
else:
@@ -350,7 +349,6 @@ def get_waka_time_stats():
stats = stats + '💬 ' + translate['Languages'] + ': \n' + lang_list + '\n\n'
if showEditors.lower() in truthy:
empty = False
if len(data['data']['editors']) == 0:
edit_list = no_activity
else:
@@ -358,17 +356,16 @@ def get_waka_time_stats():
stats = stats + '🔥 ' + translate['Editors'] + ': \n' + edit_list + '\n\n'
if showProjects.lower() in truthy:
empty = False
if len(data['data']['projects']) == 0:
project_list = no_activity
else:
# Re-order the project list by percentage
data['data']['projects'] = sorted(data['data']['projects'], key=lambda x: x["percent"], reverse=True)
data['data']['projects'] = sorted(data['data']['projects'], key=lambda x: x["percent"],
reverse=True)
project_list = make_list(data['data']['projects'])
stats = stats + '🐱‍💻 ' + translate['Projects'] + ': \n' + project_list + '\n\n'
if showOs.lower() in truthy:
empty = False
if len(data['data']['operating_systems']) == 0:
os_list = no_activity
else:
@@ -376,8 +373,7 @@ def get_waka_time_stats():
stats = stats + '💻 ' + translate['operating system'] + ': \n' + os_list + '\n\n'
stats += '```\n\n'
if empty:
return ""
return stats
@@ -551,8 +547,7 @@ if __name__ == '__main__':
user_data = run_query(userInfoQuery) # Execute the query
username = user_data["data"]["viewer"]["login"]
id = user_data["data"]["viewer"]["id"]
emails_user = run_v3_api("/user/emails") # Execute the api
email = emails_user[0]['email']
email = user_data["data"]["viewer"]["email"]
print("Username " + username)
repo = g.get_repo(f"{username}/{username}")
contents = repo.get_readme()