github-heatmap 1.3.9__tar.gz → 1.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/PKG-INFO +1 -1
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/notion_loader.py +20 -9
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap.egg-info/PKG-INFO +1 -1
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/setup.py +1 -1
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/tests/test_notion_loader.py +42 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/LICENSE +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/README.md +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/__init__.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/__main__.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/circluar_drawer.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/cli.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/config.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/drawer.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/err.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/html_parser/__init__.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/html_parser/github_parser.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/html_parser/gitlab_parser.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/html_parser/jike_parse.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/html_parser/kindle_parser.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/__init__.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/apple_health_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/base_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/bbdc_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/bilibili_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/chatgpt_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/cichang_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/config.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/covid_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/dota2_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/duolingo_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/forest_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/from_github_issue_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/garmin_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/github_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/gitlab_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/gpx_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/jike_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/json_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/kindle_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/leetcode_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/multiple_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/neodb_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/nrc_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/ns_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/openlanguage_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/shanbay_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/strava_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/summary_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/todoist_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/wakatime_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/weread_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/youtube_loader.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/poster.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/skyline/__init__.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/skyline/config.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/skyline/font/__init__.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/skyline/skyline.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/structures.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/utils.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap.egg-info/SOURCES.txt +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap.egg-info/dependency_links.txt +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap.egg-info/entry_points.txt +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap.egg-info/requires.txt +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap.egg-info/top_level.txt +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/pyproject.toml +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/setup.cfg +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/tests/__init__.py +0 -0
- {github_heatmap-1.3.9 → github_heatmap-1.4.0}/tests/test_poster_utils.py +0 -0
|
@@ -6,7 +6,7 @@ import pendulum
|
|
|
6
6
|
import requests
|
|
7
7
|
import json
|
|
8
8
|
|
|
9
|
-
from github_heatmap.loader.base_loader import BaseLoader
|
|
9
|
+
from github_heatmap.loader.base_loader import BaseLoader
|
|
10
10
|
from github_heatmap.loader.config import NOTION_API_URL, NOTION_API_VERSION
|
|
11
11
|
|
|
12
12
|
|
|
@@ -72,7 +72,9 @@ class NotionLoader(BaseLoader):
|
|
|
72
72
|
help="The Notion property name used for tooltip text.",
|
|
73
73
|
)
|
|
74
74
|
|
|
75
|
-
def get_api_data(self, start_cursor="", page_size=100, data_list=
|
|
75
|
+
def get_api_data(self, start_cursor="", page_size=100, data_list=None):
|
|
76
|
+
if data_list is None:
|
|
77
|
+
data_list = []
|
|
76
78
|
payload = {
|
|
77
79
|
"page_size": page_size,
|
|
78
80
|
"filter": {
|
|
@@ -100,14 +102,23 @@ class NotionLoader(BaseLoader):
|
|
|
100
102
|
"Authorization": "Bearer " + self.notion_token,
|
|
101
103
|
}
|
|
102
104
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
try:
|
|
106
|
+
resp = requests.post(
|
|
107
|
+
NOTION_API_URL.format(database_id=self.database_id),
|
|
108
|
+
json=payload,
|
|
109
|
+
headers=headers,
|
|
110
|
+
)
|
|
111
|
+
except requests.RequestException:
|
|
112
|
+
return data_list
|
|
113
|
+
|
|
108
114
|
if not resp.ok:
|
|
109
|
-
|
|
110
|
-
|
|
115
|
+
# Treat non-OK responses as an empty result set so we can still draw
|
|
116
|
+
# a heatmap even when the Notion API yields no rows for the period.
|
|
117
|
+
return data_list
|
|
118
|
+
try:
|
|
119
|
+
data = resp.json()
|
|
120
|
+
except ValueError:
|
|
121
|
+
return data_list
|
|
111
122
|
results = data["results"]
|
|
112
123
|
next_cursor = data["next_cursor"]
|
|
113
124
|
data_list.extend(results)
|
|
@@ -6,7 +6,7 @@ setup(
|
|
|
6
6
|
author_email="linkang.ma@gmail.com",
|
|
7
7
|
url="https://github.com/malinkang/GitHubPoster",
|
|
8
8
|
license="MIT",
|
|
9
|
-
version="1.
|
|
9
|
+
version="1.4.0",
|
|
10
10
|
description="Make everything a GitHub svg poster and Skyline!",
|
|
11
11
|
packages=find_packages(),
|
|
12
12
|
include_package_data=True,
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
|
|
3
|
+
from github_heatmap.loader import notion_loader
|
|
1
4
|
from github_heatmap.loader.notion_loader import NotionLoader
|
|
2
5
|
|
|
3
6
|
|
|
@@ -91,3 +94,42 @@ def test_notion_loader_extract_property_text_variants():
|
|
|
91
94
|
},
|
|
92
95
|
}
|
|
93
96
|
assert NotionLoader._extract_property_text(rollup_array) == "Note, Alice, Bob"
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def test_notion_loader_handles_http_error(monkeypatch):
|
|
100
|
+
loader = build_loader()
|
|
101
|
+
|
|
102
|
+
class DummyResp:
|
|
103
|
+
ok = False
|
|
104
|
+
status_code = 404
|
|
105
|
+
|
|
106
|
+
@staticmethod
|
|
107
|
+
def json():
|
|
108
|
+
return {"object": "error"}
|
|
109
|
+
|
|
110
|
+
monkeypatch.setattr(
|
|
111
|
+
notion_loader.requests, "post", lambda *args, **kwargs: DummyResp()
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
tracks, years = loader.get_all_track_data()
|
|
115
|
+
|
|
116
|
+
assert years == [2024]
|
|
117
|
+
assert tracks
|
|
118
|
+
assert all(value == 0 for value in tracks.values())
|
|
119
|
+
assert loader.number_list
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def test_notion_loader_handles_request_exception(monkeypatch):
|
|
123
|
+
loader = build_loader()
|
|
124
|
+
|
|
125
|
+
def fake_post(*args, **kwargs):
|
|
126
|
+
raise requests.RequestException("boom")
|
|
127
|
+
|
|
128
|
+
monkeypatch.setattr(notion_loader.requests, "post", fake_post)
|
|
129
|
+
|
|
130
|
+
tracks, years = loader.get_all_track_data()
|
|
131
|
+
|
|
132
|
+
assert years == [2024]
|
|
133
|
+
assert tracks
|
|
134
|
+
assert all(value == 0 for value in tracks.values())
|
|
135
|
+
assert loader.number_list
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{github_heatmap-1.3.9 → github_heatmap-1.4.0}/github_heatmap/loader/from_github_issue_loader.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|