aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-08-30 19:37:04 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-08-30 19:37:04 -0700
commit1b10d844f20df008fa9848d4ee83e294ed9c6523 (patch)
treebd4d8c5fe691595f5e606aa917887ea16560dacd /python
parentd046bee7a76576cf14a2815b787247fca8c44433 (diff)
downloadfatcat-1b10d844f20df008fa9848d4ee83e294ed9c6523.tar.gz
fatcat-1b10d844f20df008fa9848d4ee83e294ed9c6523.zip
importers: create editgroup and pass
Diffstat (limited to 'python')
-rw-r--r--python/fatcat/crossref_importer.py2
-rw-r--r--python/fatcat/importer_common.py4
-rw-r--r--python/fatcat/issn_importer.py2
-rw-r--r--python/fatcat/orcid_importer.py2
-rw-r--r--python/fatcat_client/api/default_api.py30
5 files changed, 31 insertions, 9 deletions
diff --git a/python/fatcat/crossref_importer.py b/python/fatcat/crossref_importer.py
index b12851dc..7540cf61 100644
--- a/python/fatcat/crossref_importer.py
+++ b/python/fatcat/crossref_importer.py
@@ -152,4 +152,4 @@ class FatcatCrossrefImporter(FatcatImporter):
re.container_id = container.ident
self._issnl_id_map[ce.issnl] = container.ident
release_batch.append(re)
- self.api.create_release_batch(release_batch, autoaccept=True)
+ self.api.create_release_batch(release_batch, autoaccept=True, editgroup=editgroup_id)
diff --git a/python/fatcat/importer_common.py b/python/fatcat/importer_common.py
index c1566e65..0b02d175 100644
--- a/python/fatcat/importer_common.py
+++ b/python/fatcat/importer_common.py
@@ -43,7 +43,9 @@ class FatcatImporter:
def process_batch(self, source, size=50):
"""Reads and processes in batches (not API-call-per-)"""
for rows in grouper(source, size):
- self.create_batch(rows)
+ eg = self.api.create_editgroup(
+ fatcat_client.Editgroup(editor_id='aaaaaaaaaaaabkvkaaaaaaaaae'))
+ self.create_batch(rows, editgroup_id=eg.id)
def process_csv_source(self, source, group_size=100, delimiter=','):
reader = csv.DictReader(source, delimiter=delimiter)
diff --git a/python/fatcat/issn_importer.py b/python/fatcat/issn_importer.py
index 6b806b40..2cb954e9 100644
--- a/python/fatcat/issn_importer.py
+++ b/python/fatcat/issn_importer.py
@@ -70,4 +70,4 @@ class FatcatIssnImporter(FatcatImporter):
objects = [o for o in objects if o != None]
for o in objects:
o.editgroup_id = editgroup_id
- self.api.create_container_batch(objects, autoaccept=True)
+ self.api.create_container_batch(objects, autoaccept=True, editgroup=editgroup_id)
diff --git a/python/fatcat/orcid_importer.py b/python/fatcat/orcid_importer.py
index cc12d50d..0b9860eb 100644
--- a/python/fatcat/orcid_importer.py
+++ b/python/fatcat/orcid_importer.py
@@ -71,4 +71,4 @@ class FatcatOrcidImporter(FatcatImporter):
objects = [o for o in objects if o != None]
for o in objects:
o.editgroup_id = editgroup_id
- self.api.create_creator_batch(objects, autoaccept=True)
+ self.api.create_creator_batch(objects, autoaccept=True, editgroup=editgroup_id)
diff --git a/python/fatcat_client/api/default_api.py b/python/fatcat_client/api/default_api.py
index 914f747c..a0298750 100644
--- a/python/fatcat_client/api/default_api.py
+++ b/python/fatcat_client/api/default_api.py
@@ -246,6 +246,7 @@ class DefaultApi(object):
:param async bool
:param list[ContainerEntity] entity_list: (required)
:param bool autoaccept: If true, and editor is authorized, batch is accepted all at once
+ :param str editgroup: Editgroup to auto-accept and apply to all entities (required if 'autoaccept' is True)
:return: list[EntityEdit]
If the method is called asynchronously,
returns the request thread.
@@ -268,12 +269,13 @@ class DefaultApi(object):
:param async bool
:param list[ContainerEntity] entity_list: (required)
:param bool autoaccept: If true, and editor is authorized, batch is accepted all at once
+ :param str editgroup: Editgroup to auto-accept and apply to all entities (required if 'autoaccept' is True)
:return: list[EntityEdit]
If the method is called asynchronously,
returns the request thread.
"""
- all_params = ['entity_list', 'autoaccept'] # noqa: E501
+ all_params = ['entity_list', 'autoaccept', 'editgroup'] # noqa: E501
all_params.append('async')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
@@ -300,6 +302,8 @@ class DefaultApi(object):
query_params = []
if 'autoaccept' in params:
query_params.append(('autoaccept', params['autoaccept'])) # noqa: E501
+ if 'editgroup' in params:
+ query_params.append(('editgroup', params['editgroup'])) # noqa: E501
header_params = {}
@@ -444,6 +448,7 @@ class DefaultApi(object):
:param async bool
:param list[CreatorEntity] entity_list: (required)
:param bool autoaccept: If true, and editor is authorized, batch is accepted all at once
+ :param str editgroup: Editgroup to auto-accept and apply to all entities (required if 'autoaccept' is True)
:return: list[EntityEdit]
If the method is called asynchronously,
returns the request thread.
@@ -466,12 +471,13 @@ class DefaultApi(object):
:param async bool
:param list[CreatorEntity] entity_list: (required)
:param bool autoaccept: If true, and editor is authorized, batch is accepted all at once
+ :param str editgroup: Editgroup to auto-accept and apply to all entities (required if 'autoaccept' is True)
:return: list[EntityEdit]
If the method is called asynchronously,
returns the request thread.
"""
- all_params = ['entity_list', 'autoaccept'] # noqa: E501
+ all_params = ['entity_list', 'autoaccept', 'editgroup'] # noqa: E501
all_params.append('async')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
@@ -498,6 +504,8 @@ class DefaultApi(object):
query_params = []
if 'autoaccept' in params:
query_params.append(('autoaccept', params['autoaccept'])) # noqa: E501
+ if 'editgroup' in params:
+ query_params.append(('editgroup', params['editgroup'])) # noqa: E501
header_params = {}
@@ -739,6 +747,7 @@ class DefaultApi(object):
:param async bool
:param list[FileEntity] entity_list: (required)
:param bool autoaccept: If true, and editor is authorized, batch is accepted all at once
+ :param str editgroup: Editgroup to auto-accept and apply to all entities (required if 'autoaccept' is True)
:return: list[EntityEdit]
If the method is called asynchronously,
returns the request thread.
@@ -761,12 +770,13 @@ class DefaultApi(object):
:param async bool
:param list[FileEntity] entity_list: (required)
:param bool autoaccept: If true, and editor is authorized, batch is accepted all at once
+ :param str editgroup: Editgroup to auto-accept and apply to all entities (required if 'autoaccept' is True)
:return: list[EntityEdit]
If the method is called asynchronously,
returns the request thread.
"""
- all_params = ['entity_list', 'autoaccept'] # noqa: E501
+ all_params = ['entity_list', 'autoaccept', 'editgroup'] # noqa: E501
all_params.append('async')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
@@ -793,6 +803,8 @@ class DefaultApi(object):
query_params = []
if 'autoaccept' in params:
query_params.append(('autoaccept', params['autoaccept'])) # noqa: E501
+ if 'editgroup' in params:
+ query_params.append(('editgroup', params['editgroup'])) # noqa: E501
header_params = {}
@@ -937,6 +949,7 @@ class DefaultApi(object):
:param async bool
:param list[ReleaseEntity] entity_list: (required)
:param bool autoaccept: If true, and editor is authorized, batch is accepted all at once
+ :param str editgroup: Editgroup to auto-accept and apply to all entities (required if 'autoaccept' is True)
:return: list[EntityEdit]
If the method is called asynchronously,
returns the request thread.
@@ -959,12 +972,13 @@ class DefaultApi(object):
:param async bool
:param list[ReleaseEntity] entity_list: (required)
:param bool autoaccept: If true, and editor is authorized, batch is accepted all at once
+ :param str editgroup: Editgroup to auto-accept and apply to all entities (required if 'autoaccept' is True)
:return: list[EntityEdit]
If the method is called asynchronously,
returns the request thread.
"""
- all_params = ['entity_list', 'autoaccept'] # noqa: E501
+ all_params = ['entity_list', 'autoaccept', 'editgroup'] # noqa: E501
all_params.append('async')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
@@ -991,6 +1005,8 @@ class DefaultApi(object):
query_params = []
if 'autoaccept' in params:
query_params.append(('autoaccept', params['autoaccept'])) # noqa: E501
+ if 'editgroup' in params:
+ query_params.append(('editgroup', params['editgroup'])) # noqa: E501
header_params = {}
@@ -1135,6 +1151,7 @@ class DefaultApi(object):
:param async bool
:param list[WorkEntity] entity_list: (required)
:param bool autoaccept: If true, and editor is authorized, batch is accepted all at once
+ :param str editgroup: Editgroup to auto-accept and apply to all entities (required if 'autoaccept' is True)
:return: list[EntityEdit]
If the method is called asynchronously,
returns the request thread.
@@ -1157,12 +1174,13 @@ class DefaultApi(object):
:param async bool
:param list[WorkEntity] entity_list: (required)
:param bool autoaccept: If true, and editor is authorized, batch is accepted all at once
+ :param str editgroup: Editgroup to auto-accept and apply to all entities (required if 'autoaccept' is True)
:return: list[EntityEdit]
If the method is called asynchronously,
returns the request thread.
"""
- all_params = ['entity_list', 'autoaccept'] # noqa: E501
+ all_params = ['entity_list', 'autoaccept', 'editgroup'] # noqa: E501
all_params.append('async')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
@@ -1189,6 +1207,8 @@ class DefaultApi(object):
query_params = []
if 'autoaccept' in params:
query_params.append(('autoaccept', params['autoaccept'])) # noqa: E501
+ if 'editgroup' in params:
+ query_params.append(('editgroup', params['editgroup'])) # noqa: E501
header_params = {}