Browse Source

Account for the remote URL changing to uppercase.

master
poikilos 1 year ago
parent
commit
301e08e962
  1. 34
      utilities/enissue.py

34
utilities/enissue.py

@ -3,10 +3,10 @@
''' '''
Purpose: View and cache issues in the EnlivenMinetest repo. Purpose: View and cache issues in the EnlivenMinetest repo.
Author: 2020-2021 Jake Gustafson Author: 2020-2021 Jake Gustafson
License: See license file at https://github.com/poikilos/EnlivenMinetest License: See license file at https://github.com/Poikilos/EnlivenMinetest
This script caches issues (To This script caches issues (To
~/.cache/enissue/poikilos/EnlivenMinetest/issues ~/.cache/enissue/Poikilos/EnlivenMinetest/issues
by default). by default).
Known issues: Known issues:
@ -96,7 +96,7 @@ def echo0(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs) print(*args, file=sys.stderr, **kwargs)
# https://api.github.com/repos/poikilos/EnlivenMinetest/issues/475/timeline # https://api.github.com/repos/Poikilos/EnlivenMinetest/issues/475/timeline
verbose = False verbose = False
@ -109,13 +109,13 @@ for argI in range(1, len(sys.argv)):
verbose = True verbose = True
default_options = { default_options = {
# 'repo_url': "https://api.github.com/repos/poikilos/EnlivenMinetest", # 'repo_url': "https://api.github.com/repos/Poikilos/EnlivenMinetest",
'repo_url': "https://github.com/poikilos/EnlivenMinetest", 'repo_url': "https://github.com/Poikilos/EnlivenMinetest",
} }
sites_users_repos_meta = { sites_users_repos_meta = {
'https://api.github.com': { 'https://api.github.com': {
'poikilos': { 'Poikilos': {
'EnlivenMinetest': { 'EnlivenMinetest': {
'repository_id': "80873867" 'repository_id': "80873867"
} }
@ -638,7 +638,7 @@ class Repo:
numbered json files (and numbered folders containing numbered json files (and numbered folders containing
timeline.json or other connected data) for issues will timeline.json or other connected data) for issues will
appear in appear in
"~/.cache/enissue/poikilos/EnlivenMinetest/issues". To "~/.cache/enissue/Poikilos/EnlivenMinetest/issues". To
set it later, use the setCachesPath method. set it later, use the setCachesPath method.
This is the default behavior, and the default is This is the default behavior, and the default is
os.path.join(userprofile, ".cache"). os.path.join(userprofile, ".cache").
@ -1333,22 +1333,22 @@ class Repo:
cache directory specified in options['caches_path'] and further cache directory specified in options['caches_path'] and further
narrowed down to self.c_repo_path then narrowed down using the narrowed down to self.c_repo_path then narrowed down using the
URL. For example, URL. For example,
https://api.github.com/repos/poikilos/EnlivenMinetest/issues?q=page:1 https://api.github.com/repos/Poikilos/EnlivenMinetest/issues?q=page:1
should become something like: should become something like:
~/.cache/enissue/poikilos/EnlivenMinetest/ ~/.cache/enissue/Poikilos/EnlivenMinetest/
which may contain files like "issues_page=1.json" which may contain files like "issues_page=1.json"
and and
~/.cache/enissue/poikilos/EnlivenMinetest/ ~/.cache/enissue/Poikilos/EnlivenMinetest/
...unless options['single_path'] is set: then there will be no ...unless options['single_path'] is set: then there will be no
automatically-created subdirectories (except for the usual automatically-created subdirectories (except for the usual
"issues" and other directories below that one described below). "issues" and other directories below that one described below).
https://api.github.com/repos/poikilos/EnlivenMinetest/issues/515/timeline https://api.github.com/repos/Poikilos/EnlivenMinetest/issues/515/timeline
The reactions to a timeline event are from a URL such as: The reactions to a timeline event are from a URL such as:
https://api.github.com/repos/poikilos/EnlivenMinetest/issues/comments/968357490/reactions https://api.github.com/repos/Poikilos/EnlivenMinetest/issues/comments/968357490/reactions
This method uses the following options from self.options: This method uses the following options from self.options:
token -- If set, then the header gets a new line like: token -- If set, then the header gets a new line like:
@ -1639,7 +1639,7 @@ class Repo:
evts_data_s = decode_safe(evts_res.read()) evts_data_s = decode_safe(evts_res.read())
evts_data = json.loads(evts_data_s) evts_data = json.loads(evts_data_s)
# Example: # Example:
# <https://api.github.com/repos/poikilos/EnlivenMinetest/ # <https://api.github.com/repos/Poikilos/EnlivenMinetest/
# issues/202/events> # issues/202/events>
''' '''
this_tmln_json_url = issue_data.get('timeline_url') this_tmln_json_url = issue_data.get('timeline_url')
@ -1656,7 +1656,7 @@ class Repo:
msg = ("Accessing the timeline URL failed: {}" msg = ("Accessing the timeline URL failed: {}"
"".format(err.get('reason'))) "".format(err.get('reason')))
# Example: # Example:
# <https://api.github.com/repos/poikilos/EnlivenMinetest/ # <https://api.github.com/repos/Poikilos/EnlivenMinetest/
# issues/202/timeline> # issues/202/timeline>
# #
data = tmln_data data = tmln_data
@ -1750,7 +1750,7 @@ class Repo:
# elif (event == "closed") or (event == "reopened"): # elif (event == "closed") or (event == "reopened"):
elif event == "unlabeled": elif event == "unlabeled":
# Example: # Example:
# <https://api.github.com/repos/poikilos/ # <https://api.github.com/repos/Poikilos/
# EnlivenMinetest/issues/448/timeline> # EnlivenMinetest/issues/448/timeline>
label = evt.get('label') label = evt.get('label')
if label is not None: if label is not None:
@ -1775,7 +1775,7 @@ class Repo:
if reactions_url is not None: if reactions_url is not None:
reac_data = None reac_data = None
debug(p+" reactions_url: {}".format(reactions_url)) debug(p+" reactions_url: {}".format(reactions_url))
# Example: <https://api.github.com/repos/poikilos/ # Example: <https://api.github.com/repos/Poikilos/
# EnlivenMinetest/ # EnlivenMinetest/
# issues/comments/968357490/reactions> # issues/comments/968357490/reactions>
reac_data, err = self.getCachedJsonDict( reac_data, err = self.getCachedJsonDict(
@ -2398,7 +2398,7 @@ def main(custom_args=None):
# print(label_s) # print(label_s)
# Each item in repo.label_metas is formatted like: # Each item in repo.label_metas is formatted like:
# {'id': 1285230160, 'node_id': 'MDU6TGFiZWwxMjg1MjMwMTYw', # {'id': 1285230160, 'node_id': 'MDU6TGFiZWwxMjg1MjMwMTYw',
# 'url': 'https://api.github.com/repos/poikilos/ # 'url': 'https://api.github.com/repos/Poikilos/
# EnlivenMinetest/labels/ # EnlivenMinetest/labels/
# 2016-2018%20unconfirmed%20on%20minetest.org', # 2016-2018%20unconfirmed%20on%20minetest.org',
# 'name': '2016-2018 unconfirmed on minetest.org', # 'name': '2016-2018 unconfirmed on minetest.org',

Loading…
Cancel
Save