repl.it
@functorflow/

plugin-request

Python

No description

fork
loading
Files
  • main.py
main.py
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
from flask import Flask, request, jsonify
from flask_cors import CORS
import requests
from functorflow import ff

app = Flask('app')
CORS(app)



@app.route('/handle-form', methods=['POST'])
def handle_form():
  req_data = request.get_json()
  # print(req_data)

  data = req_data

  requests.post('https://hooks.zapier.com/hooks/catch/4785377/obfxbxj/', data)

  return jsonify({'success': True})

@app.route('/new-plugin', methods=['POST'])
def new_plugin():
  req_data = request.get_json()
  issue_id = req_data['issue_id']
  data = {
    "issue_url": req_data['issue_url'],
    "title": req_data['title'],
    "desciption": req_data['description']
  }
  crud = ff.crud.new(address='97fbab8ea9cd5257ef1a44320b47604343710e0645ad2e653b4ea18fec534d72')
  crud.create('plugin-requests', issue_id, data)
  
  return jsonify({'success': True})

@app.route('/plugin-requests', methods=['GET'])
def plugin_requests():
  crud = ff.crud.new(address='97fbab8ea9cd5257ef1a44320b47604343710e0645ad2e653b4ea18fec534d72')
  return jsonify(crud.read('plugin-requests'))

app.run(host='0.0.0.0', port=8080, debug=True)