use username/password instead of shitty cookie
This commit is contained in:
parent
9e4fb19b86
commit
7370986ddd
10
app.py
10
app.py
|
@ -1,5 +1,5 @@
|
|||
from flask import Flask, request
|
||||
from gb_secrets import cookie
|
||||
from gb_secrets import credentials
|
||||
import logging, requests, os
|
||||
import re
|
||||
|
||||
|
@ -7,6 +7,9 @@ LOGLEVEL = os.environ.get('LOGLEVEL', 'INFO').upper()
|
|||
logging.basicConfig(level=LOGLEVEL)
|
||||
|
||||
app = Flask(__name__)
|
||||
session = requests.Session()
|
||||
session.post("https://www.planet-casio.com/Fr/compte",
|
||||
data=credentials)
|
||||
|
||||
def make_url_user(user):
|
||||
return f"[url=https://gitea.planet-casio.com/{user['username']}]{user['username']}[/url]"
|
||||
|
@ -16,6 +19,7 @@ def make_url_repository(repository):
|
|||
|
||||
@app.route("/", methods=["GET", "POST"])
|
||||
def main():
|
||||
global session
|
||||
data = request.json
|
||||
event = request.headers['X-Gitea-Event']
|
||||
msg = None
|
||||
|
@ -140,8 +144,8 @@ def main():
|
|||
if msg:
|
||||
msg = f"[gray][i]{msg}[/i][/gray]"
|
||||
app.logger.info(msg)
|
||||
r = requests.post("https://www.planet-casio.com/Fr/shoutbox/api/post",
|
||||
data={"message": msg, "channel": "dev"}, cookies=cookie)
|
||||
r = session.post("https://www.planet-casio.com/Fr/shoutbox/api/post",
|
||||
data={"message": msg, "channel": "dev"})
|
||||
|
||||
if r.status_code == 200:
|
||||
return "OK"
|
||||
|
|
Loading…
Reference in New Issue