Skip to content

Commit f32b783

Browse files
author
ehanson8
committed
updates
1 parent ab99e1d commit f32b783

13 files changed

+272
-12
lines changed

README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,38 @@ All of these scripts require a secrets.py file in the same directory that must c
77
password='my_dspace_password'
88
filePath = '/Users/dspace_user/dspace-data-collection/data/'
99
handlePrefix = 'http://dspace.myuni.edu/handle/'
10+
verify = True or False (no quotes). Use False if using an SSH tunnel to connect to the DSpace API
1011
```
11-
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
12+
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.
13+
14+
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.
15+
16+
The command 'requests.packages.urllib3.disable_warnings()' is used to disable the excessive warnings that will be produced if the 'verify' variable is set to False, which necessary if you are using an SSH tunnel to connect to the DSpace API.
1217

1318
**Note**: All of these scripts skip collection '24' for local reasons. To change this, edit the following portion of the script (typically between line 27-39)
1419

1520

16-
Skips collection 24:
21+
Skips collection 24:
1722

1823
for j in range (0, len (collections)):
1924
collectionID = collections[j]['id']
2025
if collectionID != 24:
2126
offset = 0
22-
23-
27+
28+
2429
No collections skipped:
2530

2631
for j in range (0, len (collections)):
2732
collectionID = collections[j]['id']
2833
if collectionID != 0:
2934
offset = 0
30-
31-
35+
36+
3237
#### [compareTwoKeysInCommunity.py](compareTwoKeysInCommunity.py)
3338
Based on user input, this script extracts the values of two specified keys from a specified community to a CSV file for comparison.
3439

3540
#### [findBogusUris.py](findBogusUris.py)
36-
This script extracts the item ID and the value of the key 'dc.identifier.uri' to a CSV file when the value does not begin with the handlePrefix specified in the secrets.py file.
41+
This script extracts the item ID and the value of the key 'dc.identifier.uri' to a CSV file when the value does not begin with the handlePrefix specified in the secrets.py file.
3742

3843
#### [findDuplicateKeys.py](findDuplicateKeys.py)
3944
Based on user input, this script extracts item IDs to a CSV file where there are multiple instances of the specified key in the item metadata.

allKeys.csv

Lines changed: 95 additions & 0 deletions
Large diffs are not rendered by default.

compareTwoKeysInCommunity.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
print 'Editing Production'
1212
except ImportError:
1313
print 'Editing Stage'
14-
14+
else:
15+
print 'Editing Stage'
16+
1517
baseURL = secrets.baseURL
1618
email = secrets.email
1719
password = secrets.password

findBogusUris.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
print 'Editing Production'
1212
except ImportError:
1313
print 'Editing Stage'
14-
14+
else:
15+
print 'Editing Stage'
16+
1517
baseURL = secrets.baseURL
1618
email = secrets.email
1719
password = secrets.password

findDuplicateKeys.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
print 'Editing Production'
1212
except ImportError:
1313
print 'Editing Stage'
14-
14+
else:
15+
print 'Editing Stage'
16+
1517
baseURL = secrets.baseURL
1618
email = secrets.email
1719
password = secrets.password

getCollectionMetadataJson.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
print 'Editing Production'
1111
except ImportError:
1212
print 'Editing Stage'
13-
13+
else:
14+
print 'Editing Stage'
15+
1416
baseURL = secrets.baseURL
1517
email = secrets.email
1618
password = secrets.password

getCompleteAndUniqueValuesForAllKeys.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
print 'Editing Production'
1515
except ImportError:
1616
print 'Editing Stage'
17+
else:
18+
print 'Editing Stage'
1719

1820
baseURL = secrets.baseURL
1921
email = secrets.email

getGlobalLanguageValues.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
print 'Editing Production'
1212
except ImportError:
1313
print 'Editing Stage'
14+
else:
15+
print 'Editing Stage'
1416

1517
baseURL = secrets.baseURL
1618
email = secrets.email

getLanguageValuesForKeys.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,23 @@
44
import csv
55
import time
66

7+
secretsVersion = raw_input('To edit production server, enter the name of the secrets file: ')
8+
if secretsVersion != '':
9+
try:
10+
secrets = __import__(secretsVersion)
11+
print 'Editing Production'
12+
except ImportError:
13+
print 'Editing Stage'
14+
else:
15+
print 'Editing Stage'
16+
717
baseURL = secrets.baseURL
818
email = secrets.email
919
password = secrets.password
1020
filePath = secrets.filePath
21+
verify = secrets.verify
22+
23+
requests.packages.urllib3.disable_warnings()
1124

1225
startTime = time.time()
1326
data = json.dumps({'email':email,'password':password})

getRecordsAndValuesForKey.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
print 'Editing Production'
1212
except ImportError:
1313
print 'Editing Stage'
14+
else:
15+
print 'Editing Stage'
1416

1517
baseURL = secrets.baseURL
1618
email = secrets.email

0 commit comments

Comments
 (0)