-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLina.py
More file actions
49 lines (39 loc) · 1.31 KB
/
Lina.py
File metadata and controls
49 lines (39 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
import json
import types
from writelog import writeLog
from AccesDB import AccessToDataBase
ADB = AccessToDataBase()
url2 = "http://192.168.11.23:8080"
KEY = '55702e566f352f5744767a71644d32796f544a58506866716b776d7569726e33544b7538427652414a7943'
#エンドポイントの設定
endpoint = 'https://api.apigw.smt.docomo.ne.jp/dialogue/v1/dialogue?APIKEY=REGISTER_KEY'
url = endpoint.replace('REGISTER_KEY', KEY)
utt_content = ''
payload = {'utt' : utt_content, 'context': ''}
headers = {'Content-type': 'application/json'}
r = requests.post(url, data=json.dumps(payload), headers=headers)
data = r.json()
writelog = writeLog('docomo')
while True:
#utt_content = ADB.listen()
#utt_content = input()
#payload['utt'] = utt_content
#payload['context'] = data['context']
#r = requests.post(url, data=json.dumps(payload), headers=headers)
#data = r.json()
#print(utt_content)
response = input(">> ")
#context = data['context']
#output
#count = 0
#--------------ログの書き出し-----------=---------
#writelog.writeLog('user',utt_content)
writelog.writeLog('system',response)
#----------------------------------------------
try:
requests.get(url2,params={"query":response})
except:
pass