Skip to content

Commit dc41074

Browse files
committed
feat(update_readme.py) : url 공백 자동 변환 기능 추가
1 parent b35c5e6 commit dc41074

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

update_readme.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from datetime import datetime
33
import pytz
44
import requests
5+
import urllib.parse
56

67
# 한국 시간대 설정
78
KST = pytz.timezone('Asia/Seoul')
@@ -81,9 +82,13 @@ def get_data(user_repo):
8182

8283
# README.md 링크만 추출
8384
if "README.md" in item['path']:
84-
links.append(f"https://github.com/{user_repo}/blob/main/{item['path']}")
85+
# 경로에 공백을 %20으로 치환
86+
encoded_path = urllib.parse.quote(item['path'])
87+
links.append(f"https://github.com/{user_repo}/blob/main/{encoded_path}")
8588
else:
86-
links.append(f"https://github.com/{user_repo}/blob/main/{item['path']}") # 다른 파일이 있다면 그대로 추가
89+
# 다른 파일이 있다면 그대로 추가
90+
encoded_path = urllib.parse.quote(item['path'])
91+
links.append(f"https://github.com/{user_repo}/blob/main/{encoded_path}")
8792

8893
return sites, difficulties, problems, commit_times, links
8994

0 commit comments

Comments
 (0)