Skip to content

Commit 6ee4793

Browse files
committed
Reviewed PR changes
1 parent abc2576 commit 6ee4793

2 files changed

Lines changed: 23 additions & 7 deletions

File tree

scripts/1-fetch/museums_victoria_fetch.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from collections import defaultdict
1414

1515
# Third-party
16-
from operator import itemgetter
1716
import requests
1817
from pygments import highlight
1918
from pygments.formatters import TerminalFormatter
@@ -171,7 +170,7 @@ def fetch_museums_victoria_data(args, session):
171170
record_counts = defaultdict(lambda: defaultdict(int))
172171
media_counts = defaultdict(lambda: defaultdict(int))
173172
licences_count = defaultdict(int)
174-
total_records_processed = 0
173+
records_processed = 0
175174

176175
# Iterate through each record type
177176
for record_type in RECORD_TYPES:
@@ -180,9 +179,10 @@ def fetch_museums_victoria_data(args, session):
180179
per_page = 100
181180
if args.limit is not None:
182181
per_page = args.limit
183-
if total_records_processed >= args.limit:
182+
if records_processed >= args.limit:
184183
LOGGER.info(
185-
f"Limit Reached: {total_records_processed} processed. Skipping remaining record types."
184+
f"Limit Reached: {records_processed} processed. "
185+
f"Skipping remaining record types."
186186
)
187187
break
188188

@@ -211,7 +211,7 @@ def fetch_museums_victoria_data(args, session):
211211
data = r.json()
212212
results = data.get("response", [])
213213
for res in results:
214-
total_records_processed += 1
214+
records_processed += 1
215215
media_list = res.get("media", [])
216216
for media_item in media_list:
217217
licence_data = media_item.get("licence")
@@ -231,7 +231,7 @@ def fetch_museums_victoria_data(args, session):
231231
headers = data.get("headers", {})
232232
total_pages = int(headers.get("totalResults", "0"))
233233

234-
if args.limit is not None and total_records_processed >= per_page:
234+
if args.limit is not None and records_processed >= per_page:
235235
break
236236
current_page += 1
237237

@@ -244,6 +244,7 @@ def fetch_museums_victoria_data(args, session):
244244
FILE3_RECORD: sort_nested_defaultdict(record_counts),
245245
}
246246

247+
247248
def sort_nested_defaultdict(d):
248249
"""Convert defaultdicts to regular dicts and sort all keys recursively."""
249250
if isinstance(d, defaultdict):
@@ -253,7 +254,6 @@ def sort_nested_defaultdict(d):
253254
return d
254255

255256

256-
257257
def main():
258258
args = parse_arguments()
259259
shared.paths_log(LOGGER, PATHS)

sources.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,19 @@ language edition of wikipedia. It runs on the Meta-Wiki API.
142142
- No API key required
143143
- Query limit: It is rate-limited only to prevent abuse
144144
- Data available through XML or JSON format
145+
146+
147+
## Museums Victoria
148+
**Description:** Museums Victoria is Australia’s
149+
largest public museum organisation, and the principal custodian of the State’s scientific,
150+
cultural and heritage collections. Its API provides access to meta data on licenses, use rights
151+
and open access. We can also get information on article type, image license, display location,
152+
locality, museum location, etc. There are 150,000 objects available.
153+
154+
**API documentation link**
155+
- [Museum Victoria API documentation](https://collections.museumsvictoria.com.au/developers)
156+
157+
**API Information**
158+
- No API key required
159+
- No query limit
160+
- At the moment it only supports the GET verb and responses are in JSON only.

0 commit comments

Comments
 (0)