Skip to content
This repository was archived by the owner on Oct 29, 2022. It is now read-only.

Commit ecdd6ed

Browse files
committed
reformat and Remove unnecessary import #7
1 parent 1278795 commit ecdd6ed

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

app/src/build_issues.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,45 @@
11
"""Takes Issues Filed in the last week and puts them in a file for the upcoming stream"""
22
import os
3-
from venv import create
4-
import httpx
5-
from datetime import datetime, timedelta
63
import pathlib
7-
from jinja2 import FileSystemLoader, Environment
4+
from datetime import datetime, timedelta
5+
6+
import httpx
7+
from jinja2 import Environment, FileSystemLoader
8+
89
# Get the date of the next friday
910

10-
api_key: str = os.environ.get('GITHUB_API_KEY', None)
11+
api_key: str = os.environ.get("GITHUB_API_KEY", None)
1112

1213
loader = FileSystemLoader("./app/templates")
1314
environment = Environment(loader=loader)
1415

16+
1517
def get_last_friday():
1618
"""Returns the previous friday"""
1719
upcoming_friday = datetime.today() - timedelta(4 - datetime.today().weekday())
1820
last_friday = upcoming_friday - timedelta(days=7)
1921
return last_friday.isoformat()
20-
22+
23+
2124
def get_issues_from_github():
2225
"""Returns the issues filed in the last week"""
23-
url = 'https://api.github.com/repos/kjaymiller/Python-Community-News/issues'
26+
url = "https://api.github.com/repos/kjaymiller/Python-Community-News/issues"
2427
since_date = get_last_friday()
25-
params = {
26-
"query": "label=Content",
27-
"since": since_date
28-
}
28+
params = {"labels": "Content", "since": since_date}
2929
request = httpx.get(url, params=params)
3030
return request.json()
3131

32+
3233
def create_post_for_week():
3334
"""Creates a markdown document for this week for render_engine to process"""
34-
friday = (datetime.today() - timedelta(4 - datetime.today().weekday())).strftime("%Y-%m-%d")
35-
current_week = pathlib.Path('app/content').joinpath(friday).with_suffix('.md')
35+
friday = (datetime.today() - timedelta(4 - datetime.today().weekday())).strftime(
36+
"%Y-%m-%d"
37+
)
38+
current_week = pathlib.Path("app/content").joinpath(friday).with_suffix(".md")
3639
issues = get_issues_from_github()
3740
template = environment.get_template("content_gen/episode_template.md")
3841
return current_week.write_text(template.render(issues=issues, date=friday))
3942

43+
4044
if __name__ == "__main__":
41-
print(create_post_for_week())
45+
print(create_post_for_week())

0 commit comments

Comments
 (0)