From 3ef1e18c4e2fe8f4d72ed7827e1e423377e8494a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kalinowski?= Date: Thu, 17 Oct 2024 09:15:02 +0200 Subject: [PATCH] fixed bugs, removed dependencies from requirements --- .gitignore | 1 + README.md | 3 ++- main.py | 15 ++++++++++----- requirements.txt | Bin 854 -> 232 bytes 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 74da93c..7cd89c3 100755 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .venv/ .env +.env_demo *.crt \ No newline at end of file diff --git a/README.md b/README.md index 614a09a..b9e9f49 100755 --- a/README.md +++ b/README.md @@ -7,4 +7,5 @@ the root certificate into the repository. Make sure the name in the global varialbes is correct. 4. Generate the Personal Access Token in Jira -5. Edit the global variables to configure your script. +5. Setup a .env file with a format: TOKEN=personal_access_token (put your own token) +6. Edit the global variables to configure your script. diff --git a/main.py b/main.py index baa1c98..d21b367 100755 --- a/main.py +++ b/main.py @@ -1,11 +1,14 @@ import requests import json import datetime +from dotenv import load_dotenv +from os import getenv -ACCESS_TOKEN = "" # Modify +load_dotenv() +ACCESS_TOKEN = getenv("TOKEN") USERNAMES = ["kalinom6"] # Modify URL = "https://globaljira.roche.com/rest/api/2" -CERT = 'Roche G3 Root CA.crt' +CERT = getenv("CERT_LOCATION") WEEKS_BACK = 1 VERBOSE = True @@ -53,6 +56,7 @@ def get_worklogs(issues): for log in data.get("worklogs", []): worklog = { "ticket_id": issue["task_id"], + "jira_link": issue["task_link"], "time_spent": log["timeSpent"], "date": log["started"], "author": log["author"]["name"] @@ -73,6 +77,7 @@ def get_days(day, weeks_back=WEEKS_BACK): days.append(str(day)) return days +# NOT FUNCTIONAL def get_weeks(day, worklogs, weeks=list()): year, weeknum, day_of_week = day.isocalendar() days = get_days(day, weeks_back=0) @@ -82,10 +87,10 @@ def get_weeks(day, worklogs, weeks=list()): days = get_days(day, weeks_back=1) get_weeks(days[0], worklogs, weeks) return weeks - - - +# TODO: implement this +def get_days_range(date_from, date_to): + pass def get_week_tickets(worklogs, days): this_week_tickets = [] diff --git a/requirements.txt b/requirements.txt index 8db13564f3bf4e4ba09020b953ea183452eee622..b4de616466313751b44a854ede7215396ced3d08 100755 GIT binary patch delta 24 gcmcb{_JWb=|G$X^A&e%I^%)f>e_#xlEWxY*0DpT3)c^nh literal 854 zcmZXT%}&EG5QO)P#G@27X$4%k@gAr@fdtYfv?(n-Jn+qKoD?c6wrtPN&a5{--wW%k zwuS8(73dH1RV{#4QDl(zMLf~lB(RJ)|^X)qSkf-U%QGa zh&#T_QIFiVuobp~uXC)pQr+=IF1_UVp8qiu7%yE2FCC%bGNvP{LAAQ6CfB)^h*58zhI4ga zVoUudM1hZD&>0=t(aWles`bR}sdp^A`a67$eHxWM@an2#g{IlSIQl+vum57ydamgg DAHaZ7