박하늘

app.js : reply updated

......@@ -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 {
......
......@@ -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]))
......