fixed bugs, removed dependencies from requirements

This commit is contained in:
Michał Kalinowski
2024-10-17 09:15:02 +02:00
parent a9fd9a95d8
commit 3ef1e18c4e
4 changed files with 13 additions and 6 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
.venv/
.env
.env_demo
*.crt

View File

@@ -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.

15
main.py
View File

@@ -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 = []

Binary file not shown.