From 6a2b4058f8a444f2403b25366765512b9d4832fd Mon Sep 17 00:00:00 2001 From: Fsoky Date: Tue, 30 Mar 2021 18:54:08 +0600 Subject: [PATCH] Some examples --- test.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test.py diff --git a/test.py b/test.py new file mode 100644 index 0000000..fe8a6c8 --- /dev/null +++ b/test.py @@ -0,0 +1,26 @@ +from flask import Flask, redirect +from dapi import DonationAlertsApi + +client = Flask(__name__) +scopes = "oauth-user-show oauth-custom_alert-store oauth-donation-index oauth-custom_alert-store oauth-goal-subscribe oauth-poll-subscribe" +api = DonationAlertsApi("client id", "client secret", "redirect uri", scopes) + + +@client.route("/", methods=["get"]) +def index(): + return redirect(api.login()) + + +@client.route("/login", methods=["get"]) +def login(): + code = api.get_code() + access_token = api.get_access_token(code) + + user = api.get_user(access_token) + donate = api.get_donations(access_token) + + return user + + +if __name__ == "__main__": + client.run(debug=True) \ No newline at end of file