Skip to content

Commit 1947188

Browse files
authored
Update replaceUnnecessarySpaces.py
1 parent ecc07bf commit 1947188

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

replaceUnnecessarySpaces.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
password = secrets.password
1111
filePath = secrets.filePath
1212

13-
handle = raw_input('Enter handle: ')
13+
communityHandle = raw_input('Enter community handle: ')
14+
key = raw_input('Enter key: ')
1415

1516
data = json.dumps({'email':email,'password':password})
1617
header = {'content-type':'application/json','accept':'application/json'}
@@ -19,7 +20,7 @@
1920
print 'authenticated'
2021
startTime = time.time()
2122

22-
endpoint = baseURL+'/rest/handle/'+handle
23+
endpoint = baseURL+'/rest/handle/'+communityHandle
2324
community = requests.get(endpoint, headers=headerAuth).json()
2425
communityID = community['id']
2526
collections = requests.get(baseURL+'/rest/communities/'+str(communityID)+'/collections', headers=headerAuth).json()
@@ -39,7 +40,7 @@
3940
itemMetadataProcessed = []
4041
metadata = requests.get(baseURL+'/rest/items/'+str(itemID)+'/metadata', headers=headerAuth).json()
4142
for i in range (0, len (metadata)):
42-
if metadata[i]['key'] == 'dc.contributor.advisor' or metadata[i]['key'] == 'dc.contributor.committeeMember':
43+
if metadata[i]['key'] == key:
4344
if ' ' in json.dumps(metadata[i]) or ' ,' in json.dumps(metadata[i]):
4445
updatedMetadataElement = json.loads(json.dumps(metadata[i]).replace(' ',' ').replace(' ',' ').replace(' ,',','))
4546
itemMetadataProcessed.append(updatedMetadataElement)

0 commit comments

Comments
 (0)