currentAttachmentId = dAttachment['id'] #get id from the 'file_attachments' json part
#Delete each req: /api/review-requests/{review_request_id}/file-attachments/{file_attachment_id}/
sDeleteAttachmentUrlc = ("%sreview-requests/" % sRboardBaseurl) +sReviewRequestId+"/file-attachments/"+str(currentAttachmentId)+'/'
umslogger.writeError("Delete attachment request: [%s]" % sDeleteAttachmentUrlc)
oRequest = urllib2.Request(sDeleteAttachmentUrlc)
oRequest.add_header("Authorization", "Basic %s" % sLoginAuthorize)
oRequest.get_method = lambda: 'DELETE'
try:
urllib2.urlopen(oRequest, timeout=15) # Delete will happen here, but a publish is needed.
except Exception as err:
#We want to catch and log. Any error doesnt matter, we will still continue with attach
umslogger.writeError("Unable to connect to review board site for form [%d (%d)] with error while doing delete attachment. [%s]" % (gnFormID, gnBuildID, str(err)))