Skip to content

Commit bd75dbf

Browse files
committed
Update API to 1.5.1.1
1 parent 9a38c2b commit bd75dbf

File tree

4 files changed

+43
-24
lines changed

4 files changed

+43
-24
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
Changelog
22
====
33

4+
#### 1.5.1.1
5+
Release date: 12/5/18
6+
* Add missing cli option for dataset subfolders
7+
8+
#### 1.5.1
9+
Release date: 12/5/18
10+
* Allow custom ca_cert files
11+
* Support uplodaing datasets with subfolders
12+
* Fix kaggle.json permissions warning
13+
414
#### 1.5.0
515
Release date: 10/19/18
616
* Update API to work with new competitions submissions backend. This change will force old API clients to update.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ Example:
304304

305305
##### Create a new dataset
306306

307-
If you want to create a new dataset, you need to initiate metadata file at first. You could fulfill this by running `kaggle datasets init -p FOLDER`.
307+
If you want to create a new dataset, you need to initiate metadata file at first. You could fulfill this by running `kaggle datasets init` as describe above.
308308

309309
```
310310
usage: kaggle datasets create [-h] [-p FOLDER] [-u] [-q] [-t]

kaggle/api/kaggle_api_extended.py

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262

6363

6464
class KaggleApi(KaggleApi):
65-
__version__ = '1.5.0'
65+
__version__ = '1.5.1.1'
6666

6767
CONFIG_NAME_PROXY = 'proxy'
6868
CONFIG_NAME_COMPETITION = 'competition'
@@ -172,10 +172,11 @@ def _load_config(self, config_data):
172172
configuration.proxy = config_data[self.CONFIG_NAME_PROXY]
173173

174174
# Cert File
175-
175+
176176
if self.CONFIG_NAME_SSL_CA_CERT in config_data:
177-
configuration.ssl_ca_cert = config_data[self.CONFIG_NAME_SSL_CA_CERT]
178-
177+
configuration.ssl_ca_cert = config_data[self.
178+
CONFIG_NAME_SSL_CA_CERT]
179+
179180
# Keep config values with class instance, and load api client!
180181

181182
self.config_values = config_data
@@ -1267,8 +1268,8 @@ def dataset_create_version(self,
12671268
self.datasets_create_version_by_id_with_http_info(
12681269
id_no, request)))
12691270
else:
1270-
if ref == self.config_values[self.
1271-
CONFIG_NAME_USER] + '/INSERT_SLUG_HERE':
1271+
if ref == self.config_values[
1272+
self.CONFIG_NAME_USER] + '/INSERT_SLUG_HERE':
12721273
raise ValueError(
12731274
'Default slug detected, please change values before '
12741275
'uploading')
@@ -1447,7 +1448,8 @@ def dataset_create_new_cli(self,
14471448
dir_mode: What to do with directories: "skip" - ignore; "zip" - compress and upload
14481449
"""
14491450
folder = folder or os.getcwd()
1450-
result = self.dataset_create_new(folder, public, quiet, convert_to_csv, dir_mode)
1451+
result = self.dataset_create_new(folder, public, quiet, convert_to_csv,
1452+
dir_mode)
14511453
if result.invalidTags:
14521454
print('The following are not valid tags and could not be added to '
14531455
'the dataset: ' + str(result.invalidTags))
@@ -2099,10 +2101,9 @@ def download_needed(self, response, outfile, quiet=True):
20992101
local_date = datetime.fromtimestamp(os.path.getmtime(outfile))
21002102
if remote_date <= local_date:
21012103
if not quiet:
2102-
print(
2103-
os.path.basename(outfile) +
2104-
': Skipping, found more recently modified local '
2105-
'copy (use --force to force download)')
2104+
print(os.path.basename(outfile) +
2105+
': Skipping, found more recently modified local '
2106+
'copy (use --force to force download)')
21062107
return False
21072108
except:
21082109
pass
@@ -2227,7 +2228,12 @@ def is_up_to_date(self, server_version):
22272228

22282229
return True
22292230

2230-
def upload_files(self, request, resources, folder, quiet=False, dir_mode='skip'):
2231+
def upload_files(self,
2232+
request,
2233+
resources,
2234+
folder,
2235+
quiet=False,
2236+
dir_mode='skip'):
22312237
""" upload files in a folder
22322238
Parameters
22332239
==========
@@ -2244,25 +2250,29 @@ def upload_files(self, request, resources, folder, quiet=False, dir_mode='skip')
22442250
full_path = os.path.join(folder, file_name)
22452251

22462252
if os.path.isfile(full_path):
2247-
exitcode = self._upload_file(file_name, full_path, quiet, request, resources)
2253+
exitcode = self._upload_file(file_name, full_path, quiet,
2254+
request, resources)
22482255
if exitcode:
22492256
return
22502257
elif os.path.isdir(full_path):
22512258
if dir_mode in ['zip', 'tar']:
22522259
temp_dir = tempfile.mkdtemp()
22532260
try:
22542261
_, dir_name = os.path.split(full_path)
2255-
archive_path = shutil.make_archive(os.path.join(temp_dir, dir_name),
2256-
dir_mode, full_path)
2262+
archive_path = shutil.make_archive(
2263+
os.path.join(temp_dir, dir_name), dir_mode,
2264+
full_path)
22572265
_, archive_name = os.path.split(archive_path)
2258-
exitcode = self._upload_file(archive_name, archive_path, quiet, request,
2259-
resources)
2266+
exitcode = self._upload_file(archive_name,
2267+
archive_path, quiet,
2268+
request, resources)
22602269
finally:
22612270
shutil.rmtree(temp_dir)
22622271
if exitcode:
22632272
return
22642273
elif not quiet:
2265-
print("Skipping folder: " + file_name + "; use '--dir-mode' to upload folders")
2274+
print("Skipping folder: " + file_name +
2275+
"; use '--dir-mode' to upload folders")
22662276
else:
22672277
if not quiet:
22682278
print('Skipping: ' + file_name)
@@ -2298,13 +2308,12 @@ def _upload_file(self, file_name, full_path, quiet, request, resources):
22982308
if file_name == item.get('path'):
22992309
upload_file.description = item.get('description')
23002310
if 'schema' in item:
2301-
fields = self.get_or_default(
2302-
item['schema'], 'fields', [])
2311+
fields = self.get_or_default(item['schema'], 'fields',
2312+
[])
23032313
processed = []
23042314
count = 0
23052315
for field in fields:
2306-
processed.append(
2307-
self.process_column(field))
2316+
processed.append(self.process_column(field))
23082317
processed[count].order = count
23092318
count += 1
23102319
upload_file.columns = processed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
setup(
2121
name='kaggle',
22-
version='1.5.0',
22+
version='1.5.1.1',
2323
description='Kaggle API',
2424
long_description=
2525
('Official API for https://www.kaggle.com, accessible using a command line '

0 commit comments

Comments
 (0)