Skip to content

Commit

Permalink
Todo hotfix KB
Browse files Browse the repository at this point in the history
  • Loading branch information
liante0904 committed Jul 12, 2024
1 parent bb749af commit 1505d29
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 38 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ jobs:
chmod 600 ~/.ssh/id_rsa
ssh -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_HOST << 'EOF'
cd $PROJECT_DIR # 실제 배포할 프로젝트 경로
git fetch --all
git reset --hard origin/master
git pull
git pull origin master
source venv/bin/activate
# setup.sh 스크립트 실행
if [ -f setup.sh ]; then
Expand Down
40 changes: 5 additions & 35 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ def KB_parse(ARTICLE_BOARD_ORDER, TARGET_URL):
print(list)

LIST_ARTICLE_TITLE = list['docTitleSub']

if ( NXT_KEY not in LIST_ARTICLE_TITLE or NXT_KEY == '' or TEST_SEND_YN == 'Y' ) and SEND_YN == 'Y':
nNewArticleCnt += 1 # 새로운 게시글 수
if len(sendMessageText) < 3500:
Expand All @@ -618,6 +618,10 @@ def KB_parse(ARTICLE_BOARD_ORDER, TARGET_URL):
LIST_ARTICLE_URL = extract_and_decode_url(LIST_ARTICLE_URL)
print('nnnnnnnnnnnnnnnn')
DownloadFile(URL = LIST_ARTICLE_URL, FILE_NAME = LIST_ARTICLE_TITLE +'.pdf')
print('?????????????????????')
LIST_ARTICLE_URL = extract_and_decode_url(LIST_ARTICLE_URL)
print('nnnnnnnnnnnnnnnn')
DownloadFile(URL = LIST_ARTICLE_URL, FILE_NAME = LIST_ARTICLE_TITLE +'.pdf')
# LIST_ARTICLE_URL = DownloadFile(URL = list['f3'], FILE_NAME = LIST_ARTICLE_TITLE +'.pdf')
sendMessageText += GetSendMessageText(INDEX = nNewArticleCnt ,ARTICLE_BOARD_NAME = BOARD_NM ,ARTICLE_TITLE = LIST_ARTICLE_TITLE, ARTICLE_URL = LIST_ARTICLE_URL)
# if TEST_SEND_YN == 'Y': return sendMessageText
Expand Down Expand Up @@ -3381,40 +3385,6 @@ def test_code():
if len(sendMessageText) > 0: sendAddText(sendMessageText, 'Y') # 쌓인 메세지를 무조건 보냅니다.
else: sendAddText('', 'Y') # 쌓인 메세지를 무조건 보냅니다.

def extract_and_decode_url(url):
"""
주어진 URL에서 id와 Base64로 인코딩된 url 값을 추출하고, 인코딩된 url 값을 디코딩하여 반환하는 함수
Parameters:
url (str): URL 문자열
Returns:
str: 추출된 id 값과 디코딩된 url 값을 포함한 문자열
"""
print(url)
# URL 파싱
parsed_url = urlparse.urlparse(url)

print(url)
# 쿼리 문자열 파싱
query_params = urlparse.parse_qs(parsed_url.query)

# id와 url 추출
id_value = query_params.get('id', [None])[0]
encoded_url = query_params.get('url', [None])[0]

if id_value is None or encoded_url is None:
return "Invalid URL: id or url is missing"

# Base64 디코딩
try:
decoded_url = base64.b64decode(encoded_url).decode('utf-8')
except Exception as e:
return f"Error decoding url: {e}"

print(f"Extracted id: {id_value}, Decoded URL: {decoded_url}")
return decoded_url

def main():
global SEC_FIRM_ORDER # 증권사 순번
global TEST_SEND_YN
Expand Down

0 comments on commit 1505d29

Please sign in to comment.