File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 2020args = parser .parse_args ()
2121
2222if args .fileName :
23- fileName = filePath + args .fileName
23+ fileName = filePath + '/ETD RDF/' + args .fileName
2424else :
25- fileName = filePath + raw_input ('Enter the file name of the CSV of changes (including \' .csv\' ): ' )
25+ fileName = filePath + '/ETD RDF/' + raw_input ('Enter the file name of the CSV of changes (including \' .csv\' ): ' )
2626if args .handle :
2727 handle = args .handle
2828else :
6161
6262f = csv .writer (open (filePath + 'replacedValues' + datetime .now ().strftime ('%Y-%m-%d %H.%M.%S' )+ '.csv' , 'wb' ))
6363f .writerow (['handle' ]+ ['replacedValue' ]+ ['replacementValue' ])
64+ with open (fileName ) as csvfile :
65+ reader = csv .DictReader (csvfile )
66+ rowCount = len (list (reader ))
6467with open (fileName ) as csvfile :
6568 reader = csv .DictReader (csvfile )
6669 for row in reader :
67- print row
70+ rowCount -= 1
6871 replacedValue = row ['replacedValue' ].decode ('utf-8' )
6972 replacementValue = row ['replacementValue' ].decode ('utf-8' )
73+ print 'Rows remaining: ' , rowCount ,
74+ print replacedValue , ' -- ' , replacementValue
7075 if replacedValue != replacementValue :
7176 print replacedValue
7277 offset = 0
7378 recordsEdited = 0
7479 items = ''
7580 while items != []:
7681 endpoint = baseURL + '/rest/filtered-items?query_field[]=*&query_op[]=equals&query_val[]=' + replacedValue + collSels + '&limit=200&offset=' + str (offset )
77- print endpoint
7882 response = requests .get (endpoint , headers = header , cookies = cookies , verify = verify ).json ()
7983 items = response ['items' ]
8084 for item in items :
You can’t perform that action at this time.
0 commit comments