26 lines
892 B
Python
26 lines
892 B
Python
from flask import Flask, jsonify, abort, request
|
||
from flask_cors import CORS, cross_origin
|
||
import requests
|
||
import json
|
||
|
||
app = Flask(__name__)
|
||
|
||
@app.route('/payload', methods=['POST'])
|
||
@cross_origin()
|
||
def push_deal():
|
||
payload = request.json
|
||
print(payload)
|
||
# 平台用户开发能力API接口
|
||
url_basic = 'https://forgeplus.trustie.net/api/users/{login}/statistics/develop.json'
|
||
# 提取事件数据找到pusher,拼接得到完整的URL
|
||
login = payload['pusher']['login']
|
||
url = url_basic.format(login=login)
|
||
# requests请求header信息配置
|
||
header = {
|
||
'User-Agent': 'Mozilla/5.0',
|
||
'Content-Type': 'application/json',
|
||
'Accept': 'application/vnd.github.v3+json'
|
||
}
|
||
# 访问api接口,获取本次pusher的开发能力信息
|
||
response = requests.get(url, headers=header)
|
||
return response.json() |