You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2020/09/07 21:04:45 UTC
[incubator-ponymail-foal] 01/05: Make oauth process async using
server runners
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit f0d8cacd620c756a109aea7708f8c92d238f1f64
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Mon Sep 7 22:56:54 2020 +0200
Make oauth process async using server runners
---
server/plugins/oauthGeneric.py | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/server/plugins/oauthGeneric.py b/server/plugins/oauthGeneric.py
index e3eb57b..fd3ff9d 100644
--- a/server/plugins/oauthGeneric.py
+++ b/server/plugins/oauthGeneric.py
@@ -3,16 +3,14 @@ import re
import requests
-def process(formdata, session):
+async def process(formdata, session, server):
js = None
m = re.match(r"https?://(.+)/", formdata["oauth_token"])
if m:
oauth_domain = m.group(1)
headers = {"User-Agent": "Pony Mail OAuth Agent/0.1"}
- rv = requests.post(formdata["oauth_token"], headers=headers, data=formdata)
- # try:
+ rv = await server.runners.run(requests.post, formdata["oauth_token"], headers=headers, data=formdata)
js = rv.json()
js["oauth_domain"] = oauth_domain
js['authoritative'] = True
-
return js