folio-data-import 0.2.0__tar.gz → 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of folio-data-import might be problematic. Click here for more details.

@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: folio_data_import
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: A python module to interact with the data importing capabilities of the open-source FOLIO ILS
5
5
  License: MIT
6
6
  Author: Brooks Travis
@@ -13,6 +13,11 @@ Classifier: Programming Language :: Python :: 3.10
13
13
  Classifier: Programming Language :: Python :: 3.11
14
14
  Classifier: Programming Language :: Python :: 3.12
15
15
  Requires-Dist: aiofiles (>=24.1.0,<25.0.0)
16
+ Requires-Dist: flake8-bandit (>=4.1.1,<5.0.0)
17
+ Requires-Dist: flake8-black (>=0.3.6,<0.4.0)
18
+ Requires-Dist: flake8-bugbear (>=24.8.19,<25.0.0)
19
+ Requires-Dist: flake8-docstrings (>=1.7.0,<2.0.0)
20
+ Requires-Dist: flake8-isort (>=6.1.1,<7.0.0)
16
21
  Requires-Dist: folioclient (>=0.60.5,<0.61.0)
17
22
  Requires-Dist: httpx (>=0.23.0,<0.24.0)
18
23
  Requires-Dist: inquirer (>=3.4.0,<4.0.0)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "folio_data_import"
3
- version = "0.2.0"
3
+ version = "0.2.1"
4
4
  description = "A python module to interact with the data importing capabilities of the open-source FOLIO ILS"
5
5
  authors = ["Brooks Travis <brooks.travis@gmail.com>"]
6
6
  license = "MIT"
@@ -22,10 +22,17 @@ inquirer = "^3.4.0"
22
22
  tqdm = "^4.66.5"
23
23
  tabulate = "^0.9.0"
24
24
  aiofiles = "^24.1.0"
25
+ flake8-black = "^0.3.6"
26
+ flake8-bugbear = "^24.8.19"
27
+ flake8-bandit = "^4.1.1"
28
+ flake8-isort = "^6.1.1"
29
+ flake8-docstrings = "^1.7.0"
25
30
 
26
31
 
27
32
  [tool.poetry.group.dev.dependencies]
28
33
  pytest = "^8.3.2"
34
+ flake8 = "^7.1.1"
35
+ black = "^24.8.0"
29
36
 
30
37
  [build-system]
31
38
  requires = ["poetry-core"]
@@ -436,6 +436,12 @@ async def main() -> None:
436
436
  parser = argparse.ArgumentParser()
437
437
  parser.add_argument("--gateway_url", type=str, help="The FOLIO API Gateway URL")
438
438
  parser.add_argument("--tenant_id", type=str, help="The FOLIO tenant ID")
439
+ parser.add_argument(
440
+ "--member_tenant_id",
441
+ type=str,
442
+ help="The FOLIO ECS member tenant ID (if applicable)",
443
+ default="",
444
+ )
439
445
  parser.add_argument("--username", type=str, help="The FOLIO username")
440
446
  parser.add_argument("--password", type=str, help="The FOLIO password", default="")
441
447
  parser.add_argument(
@@ -480,6 +486,11 @@ async def main() -> None:
480
486
  folio_client = folioclient.FolioClient(
481
487
  args.gateway_url, args.tenant_id, args.username, args.password
482
488
  )
489
+
490
+ # Set the member tenant id if provided to support FOLIO ECS multi-tenant environments
491
+ if args.member_tenant_id:
492
+ folio_client.okapi_headers["x-okapi-tenant"] = args.member_tenant_id
493
+
483
494
  if not args.import_profile_name:
484
495
  import_profiles = folio_client.folio_get(
485
496
  "/data-import-profiles/jobProfiles",
@@ -243,11 +243,11 @@ class UserImporter: # noqa: R0902
243
243
  mapped_departments.append(self.department_map[department])
244
244
  except KeyError:
245
245
  print(
246
- f'Row {line_number}: Department "{department}" not found, '
246
+ f'Row {line_number}: Department "{department}" not found, ' # noqa: B907
247
247
  f"excluding department from user"
248
248
  )
249
249
  await self.logfile.write(
250
- f'Row {line_number}: Department "{department}" not found, '
250
+ f'Row {line_number}: Department "{department}" not found, ' # noqa: B907
251
251
  f"excluding department from user\n"
252
252
  )
253
253
  user_obj["departments"] = mapped_departments
@@ -630,6 +630,11 @@ async def main() -> None:
630
630
  """
631
631
  parser = argparse.ArgumentParser()
632
632
  parser.add_argument("--tenant_id", help="The tenant id")
633
+ parser.add_argument(
634
+ "--member_tenant_id",
635
+ help="The FOLIO ECS member tenant id (if applicable)",
636
+ default="",
637
+ )
633
638
  parser.add_argument("--library_name", help="The name of the library")
634
639
  parser.add_argument("--username", help="The FOLIO username")
635
640
  parser.add_argument("--okapi_url", help="The Okapi URL")
@@ -672,8 +677,15 @@ async def main() -> None:
672
677
  args.username,
673
678
  args.folio_password
674
679
  or os.environ.get("FOLIO_PASS", "")
675
- or getpass.getpass("Enter your FOLIO password: "),
680
+ or getpass.getpass(
681
+ "Enter your FOLIO password: ",
682
+ ),
676
683
  )
684
+
685
+ # Set the member tenant id if provided to support FOLIO ECS multi-tenant environments
686
+ if args.member_tenant_id:
687
+ folio_client.okapi_headers["x-okapi-tenant"] = args.member_tenant_id
688
+
677
689
  user_file_path = Path(args.user_file_path)
678
690
  log_file_path = (
679
691
  user_file_path.parent.parent
@@ -45,7 +45,10 @@ async def main():
45
45
  parser.add_argument(
46
46
  "--consolidate",
47
47
  action="store_true",
48
- help="Consolidate records into a single job. Default is to create a new job for each MARC file.",
48
+ help=(
49
+ "Consolidate records into a single job. "
50
+ "Default is to create a new job for each MARC file."
51
+ ),
49
52
  )
50
53
  parser.add_argument(
51
54
  "--no-progress",
@@ -96,7 +99,10 @@ async def main():
96
99
  print("Error importing files: " + str(e))
97
100
  raise
98
101
  elif args.record_type.lower() == "users":
99
- print("User import not yet implemented. Run UserImport.py directly or use folio-user-import CLI.")
102
+ print(
103
+ "User import not yet implemented. Run UserImport.py directly "
104
+ "or use folio-user-import CLI."
105
+ )
100
106
  else:
101
107
  print("Record type not supported. Supported types are: MARC21")
102
108