use username/password instead of shitty cookie

This commit is contained in:
Darks 2022-04-13 22:04:51 +02:00
parent 9e4fb19b86
commit 7370986ddd
Signed by: Darks
GPG Key ID: 7515644268BE1433
1 changed files with 7 additions and 3 deletions

10
app.py
View File

@ -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"