bot deny, add hearder

This commit is contained in:
2025-05-11 00:51:05 +09:00
parent 084f46edd9
commit 1ad58eaa81
15 changed files with 472 additions and 13 deletions

28
main.py
View File

@ -13,29 +13,37 @@ print('### Get URL From DB')
db = MariaDB(dict_data)
url = db.fetch_data_from_mariadb()['url'] # 최근 항목 조회. - 2025.01.19
print(url)
# 2024-10-03 url을 이용해서 text추출
print('### Get content From URL')
origin_content = pkg.getContents(url)
# 2024-10-03 openAI를 이용하여 게시글 스타일 변경
print(origin_content)
# # 2024-10-03 openAI를 이용하여 게시글 스타일 변경
print('### Convert to Post - openAI')
openai_key = dict_data['openai_api_key']
print(f"### OpenAI Key : {openai_key}")
wp_reference_style = dict_data['wp_post_style']
print(f"### WP Reference Style : {wp_reference_style}")
open_ai = ChangeTextToPost(openai_key)
post_article = open_ai.generate_blog_post(origin_content, wp_reference_style)
print('### DEBUG ###')
print(post_article)
# print('### Convert to HTML - markdown to html')
# # 2024-10-03 Markdown을 HTML로 변환
# html = markdown.markdown(post_article)
print('### Convert to HTML - markdown to html')
# 2024-10-03 Markdown을 HTML로 변환
html = markdown.markdown(post_article)
# 2024-10-03 워드프레스 포스팅 임시등록
print('### Create post')
wp = WordPress(dict_data)
rs = wp.create_post(2,html)
# # 2024-10-03 워드프레스 포스팅 임시등록
# print('### Create post')
# wp = WordPress(dict_data)
# rs = wp.create_post(2,html)
if __name__ == "__main__":
# print(post_article)
print(post_article)
print("추가 확인을 위한 출력")
if rs.ok:
print(f"### 성공 code:{rs.status_code}")