Complete gitea issue creation API function

This commit is contained in:
Fred Boniface 2024-11-02 19:23:51 +00:00
parent 8e78319cbd
commit fb7eb20c98
4 changed files with 13 additions and 3 deletions

1
.gitignore vendored
View File

@ -4,6 +4,7 @@ organised_for_processing.txt
validated.txt
output.txt
output
*.sh
# Byte-compiled / optimized / DLL files
__pycache__/

View File

@ -2,4 +2,12 @@
Parses PDF schedule cards, extracting PIS codes and headcodes before using the OwlBoard API to build a list of PIS codes. Submitting the completed list to Git.
Interacts with OwlBoard API using pyOwlBoard
Interacts with OwlBoard API using pyOwlBoard
## Environment Variables
The following environment variables should be set:
GITEA_USER - Not Required?
GITEA_PASS - Gitea API Key
OWLBOARD_KEY - API Key (uuid) for OwlBoard. Only required if authentication is enabled

View File

@ -23,9 +23,10 @@ class GiteaConnector:
"title": title,
"body": content,
"assignees": ["fred.boniface"],
"labels": ["bug", "urgent"],
"labels": [261],
}
print(f"URL: {url}")
response = requests.post(url, headers=self.header, json=issue_data)
if response.status_code == 201:
print("Succesfully creates issue: ", response.json())

View File

@ -34,7 +34,7 @@ def filter_timetable_entries(diagram_entries):
## Checks OwlBoard API for existing PIS codes and whether they match
def check_and_validate_against_owlboard(train_entries):
ob_client = client.OwlBoardClient("https://owlboard.info", os.getenv("OWLBOARD_KEY"))
gitea_client = GiteaConnector("https://git.fjla.uk/api/v1/repos/owlboard/data", "fred.boniface", os.getenv("GITEA_PASS"))
gitea_client = GiteaConnector("https://git.fjla.uk/api/v1/repos/owlboard/data/", "fred.boniface", os.getenv("GITEA_PASS"))
output = []
for train_entry in train_entries: