summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivansivak <ivansivak@outlook.com>2022-01-21 17:02:50 +0100
committerivansivak <ivansivak@outlook.com>2022-01-21 17:02:50 +0100
commit6a06f6b7bbc4874790258e484071ce17d71c9be0 (patch)
tree9e1c0921d2ba2b71509d10aa12e2c128b6512262
parent76090a6d9c60b235d72206086c2ec2bfa565455f (diff)
minor updates
-rw-r--r--main.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/main.py b/main.py
index 5ca6e1e..6fce390 100644
--- a/main.py
+++ b/main.py
@@ -2,16 +2,24 @@ import giteapy
import csv
configuration = giteapy.Configuration()
+
+# ======================================================================================================================
+# Modify configuration for your needs
configuration.host = 'https://<YOUR GITEA URL ORIGIN>/api/v1'
-# noinspection SpellCheckingInspection
-configuration.api_key['access_token'] = '<YOUR GITEA TOKEN>' # /user/settings/applications
+configuration.api_key['access_token'] = '<MY GITEA TOKEN>' # https://<YOUR GITEA URL ORIGIN>/user/settings/applications
+my_organization_name = '<ORGANIZATION NAME FOR A GIVEN REPO>'
+my_repo_name = '<REPO NAME>'
+# ======================================================================================================================
api_client = giteapy.ApiClient(configuration)
issues_api_instance = giteapy.IssueApi(giteapy.ApiClient(configuration))
def dump_to_csv(filename, array_of_objects):
+ # we need to create list of dicts with custom properties from list of api objects fields
converted = list(map(lambda x: {'title': x.title}, array_of_objects)) # could be used vars(x) to convert all
+
+ # this is just to avoid duplicates
array_of_dicts = []
map_info = {}
for conv in converted:
@@ -46,12 +54,12 @@ def export_open_closed_issues(organization_name, repository_name):
# we need to filter issues that are not feature branches merged into main branch
closed_issues = list(filter(lambda x: x.pull_request is None or (not x.pull_request.merged),
fetch_all(owner=organization_name, repo=repository_name, state='closed')))
- print('x', closed_issues)
+
dump_to_csv('open_issues.csv', open_issues)
dump_to_csv('closed_issues.csv', closed_issues)
if __name__ == '__main__':
print('starting..')
- export_open_closed_issues(organization_name='<GITEA ORGANIZATION NAME>', repository_name='<REPO NAME>')
+ export_open_closed_issues(organization_name=my_organization_name, repository_name=my_repo_name)
print('done.')