77from .exceptions import OpenMLServerError
88
99
10- def _perform_api_call (call , data = None , file_dictionary = None ,
10+ def _perform_api_call (call , file_dictionary = None ,
1111 file_elements = None , add_authentication = True ):
1212 """
1313 Perform an API call at the OpenML server.
@@ -18,11 +18,14 @@ def _read_url(self, url, add_authentication=False, data=None, filePath=None):
1818 ----------
1919 call : str
2020 The API call. For example data/list
21- data : dict (default=None)
22- Dictionary containing data which will be sent to the OpenML
23- server via a POST request.
24- **kwargs
25- Further arguments which are appended as GET arguments.
21+ file_dictionary : dict
22+ Mapping of {filename: path} of files which should be uploaded to the
23+ server.
24+ file_elements : dict
25+ Mapping of {filename: str} of strings which should be uploaded as
26+ files to the server.
27+ add_authentication : bool
28+ Whether to add authentication (api key) to the request.
2629
2730 Returns
2831 -------
@@ -36,16 +39,16 @@ def _read_url(self, url, add_authentication=False, data=None, filePath=None):
3639 url += "/"
3740 url += call
3841 if file_dictionary is not None or file_elements is not None :
39- return _read_url_files (url , data = data , file_dictionary = file_dictionary ,
42+ return _read_url_files (url , file_dictionary = file_dictionary ,
4043 file_elements = file_elements )
41- return _read_url (url , data = data )
44+ return _read_url (url )
4245
4346
44- def _read_url_files (url , data = None , file_dictionary = None , file_elements = None ):
47+ def _read_url_files (url , file_dictionary = None , file_elements = None ):
4548 """do a post request to url with data None, file content of
4649 file_dictionary and sending file_elements as files"""
47- if data is None :
48- data = {}
50+
51+ data = {}
4952 data ['api_key' ] = config .apikey
5053 if file_elements is None :
5154 file_elements = {}
@@ -78,9 +81,9 @@ def _read_url_files(url, data=None, file_dictionary=None, file_elements=None):
7881 return response .status_code , response .text
7982
8083
81- def _read_url (url , data = None ):
82- if data is None :
83- data = {}
84+ def _read_url (url ):
85+
86+ data = {}
8487 data ['api_key' ] = config .apikey
8588
8689 # Using requests.post sets header 'Accept-encoding' automatically to
0 commit comments