Allow non-browser requests to upload Networks and create tests
This commit is contained in:
1 parent
5fde447ff0
commit
c31a9a0b2d
4 files changed
+83
No files matched your search
@@ -54,6 +54,9 @@ urlpatterns = [
|
||||
django.urls.path(r'networks/<str:action>/', OpenBench.views.networks),
|
||||
django.urls.path(r'networks/<str:action>/<str:sha256>/', OpenBench.views.networks),
|
||||
|
||||
# Links for interacting with OpenBench via scripting
|
||||
django.urls.path(r'scripts/', OpenBench.views.scripts),
|
||||
|
||||
# Links for the Client to work with the Server
|
||||
django.urls.path(r'clientGetFiles/', OpenBench.views.clientGetFiles),
|
||||
django.urls.path(r'clientGetBuildInfo/', OpenBench.views.clientGetBuildInfo),
|
||||
|
||||
@@ -580,6 +580,21 @@ def networks(request, action=None, sha256=None, client=False):
|
||||
return response
|
||||
|
||||
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
# OPENBENCH SCRIPTING #
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
|
||||
@csrf_exempt
|
||||
def scripts(request):
|
||||
|
||||
login(request) # All requests are attached to a User
|
||||
|
||||
if request.POST['action'] == 'UPLOAD':
|
||||
return networks(request, action='UPLOAD')
|
||||
|
||||
if request.POST['action'] == 'CREATE_TEST':
|
||||
return newTest(request)
|
||||
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
# CLIENT HOOK VIEWS #
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
import requests
|
||||
|
||||
# Basic Information:
|
||||
# Test options must contain 'Threads={} Hash={}'
|
||||
# Test Modes may either be of type 'SPRT' or 'GAMES'
|
||||
# Syzygy settings are { 'OPTIONAL', 'REQUIRED', 'DISABLED' }
|
||||
# Max Games is ignored unless test is of type 'GAMES'
|
||||
# Networks must be assigned using their SHA256, not their name
|
||||
# Networks with the value '' are used for tests without Networks
|
||||
|
||||
URL = 'http://chess.grantnet.us/scripts/'
|
||||
|
||||
data = {
|
||||
|
||||
'enginename' : '',
|
||||
'source' : '',
|
||||
|
||||
'devbench' : '',
|
||||
'devbranch' : '',
|
||||
'devoptions' : '
|
||||
'devnetwork' : '',
|
||||
|
||||
'basebench' : '',
|
||||
'basebranch' : '',
|
||||
'baseoptions' : '',
|
||||
'basenetwork' : '',
|
||||
|
||||
'bookname' : '',
|
||||
'timecontrol' : '',
|
||||
|
||||
'test_mode' : '',
|
||||
'bounds' : '',
|
||||
'confidence' : '',
|
||||
'max_games' : '',
|
||||
|
||||
'priority' : '',
|
||||
'throughput' : '',
|
||||
'syzygy_adj' : '',
|
||||
'syzygy_wdl' : '',
|
||||
|
||||
'username' : '',
|
||||
'password' : '',
|
||||
'action' : 'CREATE_TEST',
|
||||
}
|
||||
|
||||
r = requests.post(URL, data=data)
|
||||
|
||||
print(r.text)
|
||||
@@ -0,0 +1,17 @@
|
||||
import requests
|
||||
|
||||
URL = 'http://chess.grantnet.us/scripts/'
|
||||
FILENAME = ''
|
||||
|
||||
data = {
|
||||
'engine' : '',
|
||||
'name' : ''.
|
||||
'username' : '',
|
||||
'password' : '',
|
||||
'action' : 'UPLOAD',
|
||||
}
|
||||
|
||||
with open(FILENAME, 'rb') as file:
|
||||
r = requests.post(URL, data=data, files={'netfile' : file})
|
||||
|
||||
print(r.text)
|
||||
Reference in new issue
Block a user