community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1858389 - /comdev/reporter.apache.org/trunk/scripts/member_info.py
Date Mon, 29 Apr 2019 18:55:31 GMT
Author: sebb
Date: Mon Apr 29 18:55:31 2019
New Revision: 1858389

URL: http://svn.apache.org/viewvc?rev=1858389&view=rev
Log:
Access to member-info.json

Added:
    comdev/reporter.apache.org/trunk/scripts/member_info.py   (with props)

Added: comdev/reporter.apache.org/trunk/scripts/member_info.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/scripts/member_info.py?rev=1858389&view=auto
==============================================================================
--- comdev/reporter.apache.org/trunk/scripts/member_info.py (added)
+++ comdev/reporter.apache.org/trunk/scripts/member_info.py Mon Apr 29 18:55:31 2019
@@ -0,0 +1,42 @@
+"""
+
+Module to give access to data from member-info.json
+
+This module acts as the gatekeeper for all access to member-info.json
+which is cached from https://whimsy.apache.org/public/member-info.json
+
+"""
+
+import json
+from urlutils import UrlCache
+
+MEMBER_INFO='https://whimsy.apache.org/public/member-info.json'
+
+
+# Don't check more often than every minute
+uc = UrlCache(interval=60, silent=True)
+
+def loadJson(url):
+    resp = uc.get(url, name=None, encoding='utf-8', errors=None)
+    try:
+        content = resp.read() # json.load() does this anyway
+        try:
+            j = json.loads(content)
+        except Exception as e:
+            # The Proxy error response is around 4800 bytes
+            print("Error parsing response:\n%s" % content[0:4800])
+            raise e
+    finally:
+        resp.close()
+    return j
+
+# Only want the members
+memberdata = loadJson(MEMBER_INFO)
+
+def isASFMember(uid):
+    return uid in memberdata['members']
+
+if __name__ == '__main__':
+    import sys
+    for arg in sys.argv[1:]:
+        print("%s isASFMember: %s" % (arg, isASFMember(arg)))

Propchange: comdev/reporter.apache.org/trunk/scripts/member_info.py
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message