def post(self):
     result = spreadsheetData()
     dataframe = generateDataframe(result)
     month = request.get_json()
     batches = getBatchesForMonth(dataframe, month["month"])
     print(pd.Series(batches).to_json(orient='values'))
    # return jsonify(np.ndarray.tolist(batches))
     return jsonify(pd.Series(batches).to_json(orient='values'))
 def post(self):
     result = spreadsheetData()
     dataframe = generateDataframe(result)
     jsonData = request.get_json()
     month = jsonData["month"]
     batch = jsonData["batch"]
     dataframeData = getBatchDataForMonth(dataframe, batch, month)
     generateInvoices(dataframeData)
     return 201
 def post(self):
     result = spreadsheetData()
     dataframe = generateDataframe(result)
     jsonData = request.get_json()
     month = jsonData["month"]
     batch = jsonData["batch"]
     dataframeData = getBatchDataForMonth(dataframe, batch, month)
     print(dataframeData)
     return pd.DataFrame(dataframeData).to_json(orient="split")
 def post(self):
     result = spreadsheetData()
     dataframe = generateDataframe(result)
     jsonData = request.get_json()
     month = jsonData["month"]
     batch = jsonData["batch"]
     dataframeData = getBatchDataForMonth(dataframe, batch, month)
     messages = generateMessage(dataframeData)
     print(messages)
     return json.dumps(messages), 200
 def get(self):
     result = spreadsheetData()
     dataframe = generateDataframe(result)
     months = getMonths(dataframe)
     print(months)
     return pd.Series(months).to_json(orient='values'), 200
Beispiel #6
0
app.config['CORS_HEADERS'] = 'Content-Type'
api = Api(app)

# messenger bot
ACCESS_TOKEN = 'ACCESS_TOKEN'
VERIFY_TOKEN = 'VERIFY_TOKEN'
bot = Bot(ACCESS_TOKEN)

SCOPES = ['https://www.googleapis.com/auth/spreadsheets']

# The ID and range of a sample spreadsheet.
# Take as user input?
SAMPLE_SPREADSHEET_ID = '1xl0OP_IhryWg4eXU5F8K6GoFVDKe0gpdNo5u13WjLlI'
SAMPLE_RANGE_NAME = 'Sheet1!A1:Z1000'

# just need to redefine this
SERVICE_ACCOUNT_FILE = 'cherie-notebook-cred.json'

spreadsheetData()

# API calls
api.add_resource(ReceiveMessage, '/message')
api.add_resource(GetMonths, '/months')
api.add_resource(GetBatches, '/batches')
api.add_resource(GetBatchDataForMonth, '/batchdata')
api.add_resource(GenerateMessage, '/generatemessage')
api.add_resource(GenerateInvoices, '/generateinvoices')

if __name__ == '__main__':
    app.run(debug=True)