Spaces:
Running
on
Zero
Running
on
Zero
dfa
Browse files- command/__init__.py +0 -0
- command/n8n.py +30 -0
- mysite/routers/fastapi.py +2 -1
command/__init__.py
ADDED
File without changes
|
command/n8n.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
|
3 |
+
def post_data(url, word, thread):
|
4 |
+
# POSTリクエストのペイロード
|
5 |
+
payload = {
|
6 |
+
'word': word,
|
7 |
+
'thread': thread
|
8 |
+
}
|
9 |
+
|
10 |
+
# ヘッダーの設定(必要に応じて)
|
11 |
+
headers = {
|
12 |
+
'Content-Type': 'application/json'
|
13 |
+
}
|
14 |
+
|
15 |
+
# POSTリクエストの送信
|
16 |
+
response = requests.post(url, json=payload, headers=headers)
|
17 |
+
|
18 |
+
# レスポンスのステータスコードを表示
|
19 |
+
print(f'Status Code: {response.status_code}')
|
20 |
+
|
21 |
+
# レスポンスの内容を表示
|
22 |
+
print(f'Response Content: {response.content.decode()}')
|
23 |
+
|
24 |
+
return response
|
25 |
+
|
26 |
+
# 使用例
|
27 |
+
#url = 'https://kenken999-nodex-n8n.hf.space/webhook-test/d2d0af6e-5c42-45b6-a923-3bd2d8520e3f'
|
28 |
+
#word = 'example_word'
|
29 |
+
#thread = 'example_thread'
|
30 |
+
#post_data(url, word, thread)
|
mysite/routers/fastapi.py
CHANGED
@@ -239,7 +239,8 @@ def setup_webhook_routes(app: FastAPI):
|
|
239 |
link_url = "https://docs.google.com/spreadsheets/d/13pqP-Ywo5eRlZBsYX2m3ChARG38EoIYOowFd3cWij1c/edit?gid=283940886#gid=283940886"
|
240 |
#test_set_lide(subtitle, text)
|
241 |
thread_name = send_google_chat_card(webhook_url, title, subtitle, link_text, link_url,thmbnail)
|
242 |
-
|
|
|
243 |
#########################################################################
|
244 |
title = f""" プロンプト作成 {promps}"""
|
245 |
subtitle = f"""userid {user_id}\r\n chatid {thread_name}\r\n{prompt_res}"""
|
|
|
239 |
link_url = "https://docs.google.com/spreadsheets/d/13pqP-Ywo5eRlZBsYX2m3ChARG38EoIYOowFd3cWij1c/edit?gid=283940886#gid=283940886"
|
240 |
#test_set_lide(subtitle, text)
|
241 |
thread_name = send_google_chat_card(webhook_url, title, subtitle, link_text, link_url,thmbnail)
|
242 |
+
from command.n8n import post_data
|
243 |
+
post_data('https://kenken999-nodex-n8n.hf.space/webhook-test/d2d0af6e-5c42-45b6-a923-3bd2d8520e3f',text,thread_name)
|
244 |
#########################################################################
|
245 |
title = f""" プロンプト作成 {promps}"""
|
246 |
subtitle = f"""userid {user_id}\r\n chatid {thread_name}\r\n{prompt_res}"""
|