Skip to content

Commit 3562fde

Browse files
authored
Merge pull request #291 from openml/benchmarkpaper
for bypassing api checking
2 parents b30192a + 19a8500 commit 3562fde

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

openml/_api_calls.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,16 @@ def _read_url_files(url, data=None, file_dictionary=None, file_elements=None):
104104
def _read_url(url, data=None):
105105

106106
data = {} if data is None else data
107-
data['api_key'] = config.apikey
108-
109-
# Using requests.post sets header 'Accept-encoding' automatically to
110-
# 'gzip,deflate'
111-
response = requests.post(url, data=data)
107+
if config.apikey is not None:
108+
data['api_key'] = config.apikey
109+
110+
if len(data) == 0 or (len(data) == 1 and 'api_key' in data):
111+
# do a GET
112+
response = requests.get(url, params=data)
113+
else: # an actual post request
114+
# Using requests.post sets header 'Accept-encoding' automatically to
115+
# 'gzip,deflate'
116+
response = requests.post(url, data=data)
112117

113118
if response.status_code != 200:
114119
raise _parse_server_exception(response)

openml/study/functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def get_study(study_id):
1818
Note that some of the (data, tasks, flows, setups) fields can be empty
1919
(depending on information on the server)
2020
'''
21-
xml_string = _perform_api_call("study/%d" %(study_id))
21+
xml_string = _perform_api_call("study/%s" %str(study_id))
2222
result_dict = xmltodict.parse(xml_string)['oml:study']
2323
id = int(result_dict['oml:id'])
2424
name = result_dict['oml:name']

0 commit comments

Comments
 (0)