Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ $RECYCLE.BIN/
Network Trash Folder
Temporary Items
.apdisk
secrets.py
secretsProd.py
secrets*
*.pyc
data/*
local/*
Expand Down
2 changes: 2 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ verify_ssl = true

[packages]
requests = "*"
click = "*"
attrs = "*"

[requires]
python_version = "3.7"
36 changes: 26 additions & 10 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion addKeyValuePairOnHandleCSV.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
session = requests.post(baseURL + '/rest/login', headers=header,
verify=verify, params=data).cookies['JSESSIONID']
cookies = {'JSESSIONID': session}
headerFileUpload = {'accept': 'application/json'}


status = requests.get(baseURL + '/rest/status', headers=header,
cookies=cookies, verify=verify).json()
Expand Down
25 changes: 14 additions & 11 deletions addKeyValuePairToCollection.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@
skipColl = secrets.skipColl

parser = argparse.ArgumentParser()
parser.add_argument('-k', '--key', help='the key to be added. optional - if \
not provided, the script will ask for input')
parser.add_argument('-v', '--value', help='the value to be added. optional - \
if not provided, the script will ask for input')
parser.add_argument('-l', '--language', help='the language tag to be added. \
optional - if not provided, the script will ask for input')
parser.add_argument('-i', '--handle', help='handle of the collection. optional \
- if not provided, the script will ask for input')
parser.add_argument('-k', '--key', help='the key to be added. optional - if '
'not provided, the script will ask for input')
parser.add_argument('-v', '--value', help='the value to be added. optional - '
'if not provided, the script will ask for input')
parser.add_argument('-l', '--language', help='the language tag to be added. '
'optional - if not provided, the script will ask for '
'input')
parser.add_argument('-i', '--handle', help='handle of the collection. '
'optional - if not provided, the script will ask for '
'input')
args = parser.parse_args()

if args.key:
Expand Down Expand Up @@ -53,7 +55,7 @@
session = requests.post(baseURL + '/rest/login', headers=header,
verify=verify, params=data).cookies['JSESSIONID']
cookies = {'JSESSIONID': session}
headerFileUpload = {'accept': 'application/json'}


status = requests.get(baseURL + '/rest/status', headers=header,
cookies=cookies, verify=verify).json()
Expand Down Expand Up @@ -105,8 +107,9 @@
addedMetadataElement['value'] = addedValue
addedMetadataElement['language'] = addedLanguage
itemMetadataProcessed.append(addedMetadataElement)
provNote = '\'' + addedKey + ': ' + addedValue + '\' was added through a \
batch process on ' + datetime.now().strftime('%Y-%m-%d %H:%M:%S') + '.'
provNote = ('\'' + addedKey + ': ' + addedValue + '\' was added through a '
+ 'batch process on '
+ datetime.now().strftime('%Y-%m-%d %H:%M:%S') + '.')
provNoteElement = {}
provNoteElement['key'] = 'dc.description.provenance'
provNoteElement['value'] = provNote
Expand Down
19 changes: 10 additions & 9 deletions addKeyValuePairToCommunity.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
skipColl = secrets.skipColl

parser = argparse.ArgumentParser()
parser.add_argument('-k', '--key', help='the key to be added. optional - if \
not provided, the script will ask for input')
parser.add_argument('-v', '--value', help='the value to be added. optional - \
if not provided, the script will ask for input')
parser.add_argument('-l', '--language', help='the language tag to be added. \
optional - if not provided, the script will ask for input')
parser.add_argument('-i', '--handle', help='handle of the community. optional \
- if not provided, the script will ask for input')
parser.add_argument('-k', '--key', help='the key to be added. optional - if '
'not provided, the script will ask for input')
parser.add_argument('-v', '--value', help='the value to be added. optional - '
'if not provided, the script will ask for input')
parser.add_argument('-l', '--language', help='the language tag to be added. '
'optional - if not provided, the script will ask for '
'input')
parser.add_argument('-i', '--handle', help='handle of the community. optional '
'- if not provided, the script will ask for input')
args = parser.parse_args()

if args.key:
Expand Down Expand Up @@ -53,7 +54,7 @@
session = requests.post(baseURL + '/rest/login', headers=header, verify=verify,
params=data).cookies['JSESSIONID']
cookies = {'JSESSIONID': session}
headerFileUpload = {'accept': 'application/json'}


status = requests.get(baseURL + '/rest/status', headers=header,
cookies=cookies, verify=verify).json()
Expand Down
18 changes: 11 additions & 7 deletions addNewItemsToCollection.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@
skipColl = secrets.skipColl

parser = argparse.ArgumentParser()
parser.add_argument('-d', '--directory', help='the directory of files to be \
ingested. optional - if not provided, the script will ask for input')
parser.add_argument('-e', '--fileExtension', help='the extension of files to \
be ingested. optional - if not provided, the script will ask for input')
parser.add_argument('-i', '--handle', help='handle of the object to retreive. \
optional - if not provided, the script will ask for input')
parser.add_argument('-d', '--directory', help='the directory of files to be '
'ingested. optional - if not provided, the script will '
'ask for input')
parser.add_argument('-e', '--fileExtension', help='the extension of files to '
'be ingested. optional - if not provided, the script will '
'ask for input')
parser.add_argument('-i', '--handle', help='handle of the object to retreive. '
'optional - if not provided, the script will ask for '
'input')
args = parser.parse_args()

if args.directory:
Expand Down Expand Up @@ -68,11 +71,12 @@
session = requests.post(baseURL + '/rest/login', headers=header, verify=verify,
params=data).cookies['JSESSIONID']
cookies = {'JSESSIONID': session}
headerFileUpload = {'accept': 'application/json'}

status = requests.get(baseURL + '/rest/status', headers=header,
cookies=cookies, verify=verify).json()
userFullName = status['fullname']
print('authenticated', userFullName)
headerFileUpload = {'accept': 'application/json'}

# Get collection ID
endpoint = baseURL + '/rest/handle/' + handle
Expand Down
14 changes: 7 additions & 7 deletions checkInventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ def main():
parser = argparse.ArgumentParser()

parser.add_argument('-i', '--inventory', required=True,
help='csv file containing the inventory. the path, if \
given, can be absolute or relative to this script')
help='csv file containing the inventory. the path, if '
'given, can be absolute or relative to this script')

parser.add_argument('-d', '--dataDir',
help='directory containing the data. if omitted, data \
will be read from the directory containing the \
inventory file')
help='directory containing the data. if omitted, data '
'will be read from the directory containing the '
'inventory file')

parser.add_argument('-f', '--field',
help='field in the csv containing the fileNames. \
default: name')
help='field in the csv containing the fileNames. '
'default: name')

parser.add_argument('-v', '--verbose', action='store_true',
help='increase output verbosity')
Expand Down
17 changes: 10 additions & 7 deletions compareTwoKeysInCommunity.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@
skipColl = secrets.skipColl

parser = argparse.ArgumentParser()
parser.add_argument('-1', '--key', help='the first key to be output. \
optional - if not provided, the script will ask for input')
parser.add_argument('-2', '--key2', help='the second key to be output. \
optional - if not provided, the script will ask for input')
parser.add_argument('-i', '--handle', help='handle of the community to \
retreive. optional - if not provided, the script will ask for input')
parser.add_argument('-1', '--key', help='the first key to be output. '
'optional - if not provided, the script will ask for '
'input')
parser.add_argument('-2', '--key2', help='the second key to be output. '
'optional - if not provided, the script will ask for '
'input')
parser.add_argument('-i', '--handle', help='handle of the community to '
'retreive. optional - if not provided, the script will '
'ask for input')
args = parser.parse_args()

if args.key:
Expand All @@ -45,7 +48,7 @@
session = requests.post(baseURL + '/rest/login', headers=header, verify=verify,
params=data).cookies['JSESSIONID']
cookies = {'JSESSIONID': session}
headerFileUpload = {'accept': 'application/json'}


status = requests.get(baseURL + '/rest/status', headers=header,
cookies=cookies, verify=verify).json()
Expand Down
2 changes: 1 addition & 1 deletion countInitialedNamesByCollection.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
session = requests.post(baseURL + '/rest/login', headers=header, verify=verify,
params=data).cookies['JSESSIONID']
cookies = {'JSESSIONID': session}
headerFileUpload = {'accept': 'application/json'}


status = requests.get(baseURL + '/rest/status', headers=header,
cookies=cookies, verify=verify).json()
Expand Down
2 changes: 1 addition & 1 deletion deleteBitstreamsFromItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
session = requests.post(baseURL + '/rest/login', headers=header, verify=verify,
params=data).cookies['JSESSIONID']
cookies = {'JSESSIONID': session}
headerFileUpload = {'accept': 'application/json'}


status = requests.get(baseURL + '/rest/status', headers=header,
cookies=cookies, verify=verify).json()
Expand Down
12 changes: 7 additions & 5 deletions deleteKeyFromCollection.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
skipColl = secrets.skipColl

parser = argparse.ArgumentParser()
parser.add_argument('-k', '--deletedKey', help='the key to be deleted. \
optional - if not provided, the script will ask for input')
parser.add_argument('-i', '--handle', help='handle of the collection to \
retreive. optional - if not provided, the script will ask for input')
parser.add_argument('-k', '--deletedKey', help='the key to be deleted. '
'optional - if not provided, the script will ask for '
'input')
parser.add_argument('-i', '--handle', help='handle of the collection to '
'retreive. optional - if not provided, the script will '
'ask for input')
args = parser.parse_args()

if args.deletedKey:
Expand All @@ -42,7 +44,7 @@
session = requests.post(baseURL + '/rest/login', headers=header, verify=verify,
params=data).cookies['JSESSIONID']
cookies = {'JSESSIONID': session}
headerFileUpload = {'accept': 'application/json'}


status = requests.get(baseURL + '/rest/status', headers=header,
cookies=cookies, verify=verify).json()
Expand Down
12 changes: 7 additions & 5 deletions deleteKeyFromCommunity.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
skipColl = secrets.skipColl

parser = argparse.ArgumentParser()
parser.add_argument('-k', '--deletedKey', help='the key to be deleted. \
optional - if not provided, the script will ask for input')
parser.add_argument('-i', '--handle', help='handle of the community to \
retreive. optional - if not provided, the script will ask for input')
parser.add_argument('-k', '--deletedKey', help='the key to be deleted. '
'optional - if not provided, the script will ask for '
'input')
parser.add_argument('-i', '--handle', help='handle of the community to '
'retreive. optional - if not provided, the script will '
'ask for input')
args = parser.parse_args()

if args.deletedKey:
Expand All @@ -42,7 +44,7 @@
session = requests.post(baseURL + '/rest/login', headers=header, verify=verify,
params=data).cookies['JSESSIONID']
cookies = {'JSESSIONID': session}
headerFileUpload = {'accept': 'application/json'}


status = requests.get(baseURL + '/rest/status', headers=header,
cookies=cookies, verify=verify).json()
Expand Down
17 changes: 10 additions & 7 deletions deleteKeyValuePairFromCollection.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@
skipColl = secrets.skipColl

parser = argparse.ArgumentParser()
parser.add_argument('-k', '--deletedKey', help='the key to be deleted. \
optional - if not provided, the script will ask for input')
parser.add_argument('-v', '--deletedValue', help='the value to be deleted. \
optional - if not provided, the script will ask for input')
parser.add_argument('-i', '--handle', help='handle of the community to \
retreive. optional - if not provided, the script will ask for input')
parser.add_argument('-k', '--deletedKey', help='the key to be deleted. '
'optional - if not provided, the script will ask for '
'input')
parser.add_argument('-v', '--deletedValue', help='the value to be deleted. '
'optional - if not provided, the script will ask for '
'input')
parser.add_argument('-i', '--handle', help='handle of the community to '
'retreive. optional - if not provided, the script will '
'ask for input')
args = parser.parse_args()

if args.deletedKey:
Expand All @@ -47,7 +50,7 @@
session = requests.post(baseURL + '/rest/login', headers=header, verify=verify,
params=data).cookies['JSESSIONID']
cookies = {'JSESSIONID': session}
headerFileUpload = {'accept': 'application/json'}


status = requests.get(baseURL + '/rest/status', headers=header,
cookies=cookies, verify=verify).json()
Expand Down
Loading