# To setup Digital NZ's Python library code for accessing their API, # along with supporting files, run: ./01-PREP.sh # Note: # Edit the start of this file to control whether or not the script # clones the live github repository, or untars the snapshot of the # code taken, representing a 'checkpoint' version that is known # to work with the Greenstone/Atea code written that uses the # Python library # To access the Digtial NZ API and download JSON records which match # 'language=mi' run: ./02-RUN.sh # Notes: # This runs the Python3 version of the script. # # The API returns duplicated dc_identifiers, so the number of records # ingested into Greenstone is ultimately smaller than the number of # records reported as matching in the Digital NZ API # # Script utilizes the /v3/ version of the API (latest version at # the time the script was being developed) # General Notes about the developed bespoke Python scripts that # call the API # The developed script was initially written for python2 # # In a later period of development it was ported to python3 # Main different (other than print/print()) was how to # handle UTF-8 data input/output as UTF8 # # The python3 script follows the 'futures' pattern, looking # to be backwards compatible with python2, but this hasn't # been tested. # # The python2 version of the script hasn't been updated to # match improvements made to the python3 scripts, such as # reading in a key from a file, and outputing to 'downloads' # rather than the more confusingly named 'import', but # it is otherwise basically sound. # Overall ... # # The needs of the DNZ python scripts seems pretty light # The system installed python3 most recently trialed had all the # necessary packages. Other than setting PYTHONPATH so it could # see the code in the pydnz folder, things ran smoothly # # If need be, virtualenv setup such as # # virtualenv --python=python3 venv-python3-dnz # # Combined with (from within 'pydnz): # # pip install -r requirements.txt # # should help # # Note: # Running 'python setup.py install' in 'pydnz' resulted # in SSL errors trying to download from the python/pip # repository that seem to be related to a change a while # back in python that broke a lot of package installers, and # proved to be excessively fussy to resolve (something the # developers of pydnz to do???), hence the decision to go # down the PYTHONPATH path route for now #