Skip to content

Commit c677d0b

Browse files
committed
changed item retrieval method & added skipped collections
1 parent 2bd7fb1 commit c677d0b

21 files changed

+70
-57
lines changed

README.md

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,12 @@ All of these scripts require a secrets.py file in the same directory that must c
1010
filePath = '/Users/dspace_user/dspace-data-collection/data/'
1111
handlePrefix = 'http://dspace.myuni.edu/handle/'
1212
verify = True or False (no quotes). Use False if using an SSH tunnel to connect to the DSpace API
13+
skippedCollections = A list of the 'uuid' of any collections that you wish the script to skip. (e.g. ['45794375-6640-4efe-848e-082e60bae375'])
1314
```
1415
The 'filePath' is directory into which output files will be written and 'handlePrefix' may or may not vary from your DSpace URL depending on your configuration. This secrets.py file will be ignored according to the repository's .gitignore file so that DSpace login details will not be inadvertently exposed through GitHub.
1516

1617
If you are using both a development server and a production server, you can create a separate secrets.py file with a different name (e.g. secretsProd.py) and containing the production server information. When running each of these scripts, you will be prompted to enter the file name (e.g 'secretsProd' without '.py') of an alternate secrets file. If you skip the prompt or incorrectly type the file name, the scripts will default to the information in the secrets.py file. This ensures that you will only access the production server if you really intend to.
1718

18-
**Note**: All of these scripts skip collection '45794375-6640-4efe-848e-082e60bae375' for local reasons. To change this, edit the following portion of the script (typically between line 27-39)
19-
20-
21-
Skips collection 45794375-6640-4efe-848e-082e60bae375:
22-
23-
for j in range (0, len (collections)):
24-
collectionID = collections[j]['uuid']
25-
if collectionID != '45794375-6640-4efe-848e-082e60bae375':
26-
offset = 0
27-
28-
29-
No collections skipped:
30-
31-
for j in range (0, len (collections)):
32-
collectionID = collections[j]['uuid']
33-
if collectionID != 0:
34-
offset = 0
35-
3619
#### [compareTwoKeysInCommunity.py](compareTwoKeysInCommunity.py)
3720
Based on user input, extracts the values of two specified keys from a specified community to a CSV file for comparison.
3821

compareTwoKeysInCommunity.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
print 'Editing Stage'
1616
else:
1717
print 'Editing Stage'
18-
18+
1919
parser = argparse.ArgumentParser()
2020
parser.add_argument('-1', '--key', help='the first key to be output. optional - if not provided, the script will ask for input')
2121
parser.add_argument('-2', '--key2', help='the second key to be output. optional - if not provided, the script will ask for input')
@@ -43,6 +43,7 @@
4343
password = secrets.password
4444
filePath = secrets.filePath
4545
verify = secrets.verify
46+
skippedCollections = secrets.skippedCollections
4647

4748
startTime = time.time()
4849
data = {'email':email,'password':password}
@@ -64,7 +65,7 @@
6465
for j in range (0, len (collections)):
6566
collectionID = collections[j]['uuid']
6667
print collectionID
67-
if collectionID != '45794375-6640-4efe-848e-082e60bae375':
68+
if collectionID not in skippedCollections:
6869
offset = 0
6970
items = ''
7071
while items != []:

countInitialedNamesByCollection.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
password = secrets.password
2424
filePath = secrets.filePath
2525
verify = secrets.verify
26+
skippedCollections = secrets.skippedCollections
2627

2728
startTime = time.time()
2829
data = {'email':email,'password':password}
@@ -43,7 +44,7 @@
4344
collections = requests.get(baseURL+'/rest/communities/'+str(communityID)+'/collections', headers=header, cookies=cookies, verify=verify).json()
4445
for collection in collections:
4546
collectionID = collection['uuid']
46-
if collectionID != '45794375-6640-4efe-848e-082e60bae375':
47+
if collectionID not in skippedCollections:
4748
collectionIds.append(collectionID)
4849

4950
names = []

exportCollectionMetadataToCSV.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
password = secrets.password
2424
filePath = secrets.filePath
2525
verify = secrets.verify
26+
skippedCollections = secrets.skippedCollections
2627

2728
parser = argparse.ArgumentParser()
2829
parser.add_argument('-i', '--handle', help='handle of the collection to retreive. optional - if not provided, the script will ask for input')

exportSelectedRecordMetadataToCSV.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
password = secrets.password
2424
filePath = secrets.filePath
2525
verify = secrets.verify
26+
skippedCollections = secrets.skippedCollections
2627

2728
parser = argparse.ArgumentParser()
2829
parser.add_argument('-f', '--fileName', help='the CSV file of record handles. optional - if not provided, the script will ask for input')

findBogusUris.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
filePath = secrets.filePath
2424
handlePrefix = secrets.handlePrefix
2525
verify = secrets.verify
26+
skippedCollections = secrets.skippedCollections
2627

2728
startTime = time.time()
2829
data = {'email':email,'password':password}

findDuplicateKeys.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
password = secrets.password
3333
filePath = secrets.filePath
3434
verify = secrets.verify
35+
skippedCollections = secrets.skippedCollections
3536

3637
searchString = "\""+key+"\""
3738

getBitstreams.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ def main():
9898

9999
if not args.verify:
100100
args.verify = secrets.verify
101+
skippedCollections = secrets.skippedCollections
101102

102103
if args.handle:
103104
handle = args.handle

getCollectionMetadataJson.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
password = secrets.password
2222
filePath = secrets.filePath
2323
verify = secrets.verify
24+
skippedCollections = secrets.skippedCollections
2425

2526
handle = raw_input('Enter handle: ')
2627

getCompleteAndUniqueValuesForAllKeys.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
password = secrets.password
2626
filePath = secrets.filePath
2727
verify = secrets.verify
28+
skippedCollections = secrets.skippedCollections
2829

2930
filePathComplete = filePath+'completeValueLists'+datetime.now().strftime('%Y-%m-%d %H.%M.%S')+'/'
3031
filePathUnique = filePath+'uniqueValueLists'+datetime.now().strftime('%Y-%m-%d %H.%M.%S')+'/'
@@ -48,7 +49,7 @@
4849
collections = requests.get(baseURL+'/rest/communities/'+str(communityID)+'/collections', headers=header, cookies=cookies, verify=verify).json()
4950
for j in range (0, len (collections)):
5051
collectionID = collections[j]['uuid']
51-
if collectionID != '45794375-6640-4efe-848e-082e60bae375':
52+
if collectionID not in skippedCollections:
5253
collectionIds.append(collectionID)
5354

5455
os.mkdir(filePathComplete)

0 commit comments

Comments
 (0)