-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcirc_checkin.py
More file actions
40 lines (34 loc) · 914 Bytes
/
circ_checkin.py
File metadata and controls
40 lines (34 loc) · 914 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import os
import sys
import ldlite
ld = ldlite.LDLite()
ld.set_folio_max_retries(6)
ld.connect_folio(
url=os.environ['FOLIOURL'],
tenant=os.environ['FOLIOTENANT'],
user=os.environ['FOLIOUSER'],
password=os.environ['FOLIOPASSWORD'],
)
db = ld.connect_db_postgresql(dsn=f"""
dbname={os.environ['PGDATABASE']}
host={os.environ['PGHOST']}
port={os.environ['PGPORT']}
user={os.environ['PGUSER']}
password={os.environ['PGPASSWORD']}
""")
queries = [
('circulation.check_in', '/check-in-storage/check-ins'),
]
tables = []
for q in queries:
try:
t = ld.query(table=q[0], path=q[1], keep_raw=False)
tables += t
except Exception as ex:
print('folio_demo.py: error processing "' + q[1] + '"', file=sys.stderr)
print(ex, file=sys.stderr)
print()
print('Tables:')
for t in tables:
print(t)
print('(' + str(len(tables)) + ' tables)')