Authentiate via 'credentials' to extend API request limit from 60x -> 5000x
This commit is contained in:
1 parent
6bf4439cac
commit
d5f97abe8d
2 files changed
+11
-3
No files matched your search
+2
-1
@@ -3,4 +3,5 @@ Client/*
|
||||
!Client/OpenBench.py
|
||||
!Client/Client.py
|
||||
!Client/cleanup.sh
|
||||
OpenBench/migrations/*
|
||||
OpenBench/migrations/*
|
||||
credentials
|
||||
+9
-2
@@ -18,7 +18,7 @@
|
||||
# #
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
|
||||
import math, re, requests, random, datetime
|
||||
import math, re, requests, random, datetime, os
|
||||
|
||||
import OpenBench.models, OpenBench.stats
|
||||
|
||||
@@ -135,7 +135,14 @@ def getBranch(request, errors, name):
|
||||
target = pathjoin(target, url, branch).rstrip('/')
|
||||
|
||||
try:
|
||||
data = requests.get(target).json()
|
||||
|
||||
if os.path.exists('credentials'):
|
||||
with open('credentials') as fin:
|
||||
user, token = fin.readlines()[0].rstrip().split()
|
||||
auth = requests.auth.HTTPBasicAuth(user, token)
|
||||
else: auth = None
|
||||
|
||||
data = requests.get(target, auth=auth).json()
|
||||
data = data if bysha else data['commit']
|
||||
|
||||
except:
|
||||
|
||||
Reference in new issue
Block a user