Toggle navigation
Toggle navigation
This project
Loading...
Sign in
박하늘
/
stock_chatbot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
박하늘
2021-05-30 23:24:22 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
72a8ad480249044cb2e32d281ad30462a8dfa57c
72a8ad48
1 parent
31683682
app.js : reply updated
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
10 deletions
server/app.js
server/basic.py
server/app.js
View file @
72a8ad4
...
...
@@ -15,16 +15,15 @@ app.post('/hook', function (req, res) {
var
eventObj
=
req
.
body
.
events
[
0
];
var
source
=
eventObj
.
source
;
var
message
=
eventObj
.
message
;
var
spawn
=
require
(
'child_process'
).
spawn
;
var
process
=
spawn
(
'pyhton3'
,
[
"./basic.py"
,
eventObj
.
message
.
text
]);
process
.
stdout
.
on
(
'data'
,
function
(
data
){
console
.
log
(
data
.
toString
());
})
var
message
=
eventObj
.
message
;
var
pystring
;
const
spawn
=
require
(
"child_process"
).
spawn
;
const
process
=
spawn
(
"python"
,
[
"basic.py"
,
eventObj
.
message
.
text
]);
const
Callback
=
(
data
)
=>
{
console
.
log
(
"Data :"
,
data
.
toString
());
pystring
=
data
.
toString
();
// request log
console
.
log
(
'======================'
,
new
Date
()
,
'======================'
);
console
.
log
(
'[request]'
,
req
.
body
);
...
...
@@ -42,7 +41,7 @@ app.post('/hook', function (req, res) {
"messages"
:[
{
"type"
:
"text"
,
"text"
:
"Hello"
"text"
:
pystring
},
{
"type"
:
"text"
,
...
...
@@ -56,6 +55,12 @@ app.post('/hook', function (req, res) {
res
.
sendStatus
(
200
);
};
process
.
stdout
.
on
(
"data"
,
Callback
);
});
try
{
...
...
server/basic.py
View file @
72a8ad4
...
...
@@ -2,6 +2,7 @@ import FinanceDataReader as fdr
import
pandas
as
pd
import
sys
def
basicinform
(
input
):
stocks
=
pd
.
read_csv
(
'stockcodename.csv'
,
index_col
=
0
)
symbol
=
''
...
...
@@ -23,5 +24,8 @@ def basicinform(input):
}
return
value
# print(basicinform('삼성전자'))
args
=
sys
.
argv
print
(
basicinform
(
sys
.
args
[
1
]))
print
(
basicinform
(
args
[
1
]))
...
...
Please
register
or
login
to post a comment