def getImagesJSON(timestamp, tags, username, token, secret): oauth_verify_code = verifyOauth(token, secret) if oauth_verify_code != 200: return oauth_error_json rtnJSON = {'imgs' : 'get_images_placeholder'} return rtnJSON
def uploadImageJSON(username, blob, filename, token, secret, tags): #checks given oauth credentials oauth_verify_code = verifyOauth(token, secret) #checks if methods gave an error # if there is an error, returns an oauth error json if oauth_verify_code != 200: return oauth_error_json #calls method to upload blob to storage rtnBlobList = uploadBlob(username, blob, filename) #checks if an array with a timestamp and blob url were returned if len(rtnBlobList) < 2: #reurns error json is the array doesn't contain the blob url or timestamp return upload_image_blob_error_json #calls method to create a meta data document in documentdb rtnDocumentdbMsg = createRecord(username, filename, tags, rtnBlobList[0], rtnBlobList[1]) #checks if there was an error if rtnDocumentdbMsg == 'error': #returns error json return upload_image_db_error_json #return success json return upload_image_success_json
def deleteImageJSON(username, blobURL, token, secret): oauth_verify_code = verifyOauth(token, secret) if oauth_verify_code != 200: return oauth_error_json rtnBlobList = deleteBlob(blobURL) if rtnBlobList[0] != "success": return delete_image_blob_error_json return delete_image_success_json
def getImagesJSON(timestamp, prev, tags, username, token, secret): oauth_verify_code = verifyOauth(token, secret) if oauth_verify_code != 200: return oauth_error_json rec_json = getRecords(username, timestamp, prev, tags) if rec_json == 'error': return get_image_error_json rtn_json = {'status': 'success', 'imgs': rec_json} return rtn_json
def getImagesJSON(timestamp, prev, tags, username, token, secret): oauth_verify_code = verifyOauth(token, secret) if oauth_verify_code != 200: return oauth_error_json rec_json = getRecords(username, timestamp, prev, tags) if rec_json == "error": return get_image_error_json rtn_json = {"status": "success", "imgs": rec_json} return rtn_json
def uploadImageJSON(username, blob, filename, token, secret, tags): oauth_verify_code = verifyOauth(token, secret) if oauth_verify_code != 200: return oauth_error_json rtnBlobList = uploadBlob(username, blob, filename) if len(rtnBlobList) < 2: return upload_image_blob_error_json rtnDocumentdbMsg = makeMetadata(username, filename, tags.split(","), rtnBlobList[0], rtnBlobList[1]) if rtnDocumentdbMsg != "success": return upload_image_db_error_json return upload_image_success_json
def deleteImageJSON(blobURL, token, secret): oauth_verify_code = verifyOauth(token, secret) if oauth_verify_code != 200: return oauth_error_json rtnBlobList = deleteBlob(blobURL) if rtnBlobList != 'success': return delete_image_blob_error_json rtnDbMsg = deleteRecord(blobURL) if rtnDbMsg != 'success': return delete_image_db_error_json return delete_image_success_json
def deleteImageJSON(blobURL, token, secret): oauth_verify_code = verifyOauth(token, secret) if oauth_verify_code != 200: return oauth_error_json rtnBlobList = deleteBlob(blobURL) if rtnBlobList != "success": return delete_image_blob_error_json rtnDbMsg = deleteRecord(blobURL) if rtnDbMsg != "success": return delete_image_db_error_json return delete_image_success_json
def uploadImageJSON(username, blob, filename, token, secret, tags): oauth_verify_code = verifyOauth(token, secret) if oauth_verify_code != 200: return oauth_error_json rtnBlobList = uploadBlob(username, blob, filename) if len(rtnBlobList) < 2: return upload_image_blob_error_json rtnDocumentdbMsg = makeMetadata(username, filename, tags, rtnBlobList[0], rtnBlobList[1]) if rtnDocumentdbMsg != "success": return upload_image_db_error_json return upload_image_success_json
def updateTagsJSON(blobURL, tags, token, secret): #checks given oauth credentials oauth_verify_code = verifyOauth(token, secret) #checks if methods gave an error # if there is an error, returns an oauth error json if oauth_verify_code != 200: return oauth_error_json #calls method to update tags in a given record in documentdb rtnDbMsg = updateRecord(blobURL, tags) if rtnDbMsg == 'error': #returns error json if there was an error #updating the metadata return update_tags_error_json #return success json return update_tags_success_json
def updateTagsJSON(blobURL, tags, token, secret): #checks given oauth credentials oauth_verify_code = verifyOauth(token, secret) #checks if methods gave an error # if there is an error, returns an oauth error json if oauth_verify_code != 200: return oauth_error_json #calls method to update tags in a given record in documentdb rtnDbMsg = updateRecord(blobURL,tags) if rtnDbMsg == 'error': #returns error json if there was an error #updating the metadata return update_tags_error_json #return success json return update_tags_success_json
def getImagesJSON(timestamp, prev, tags, username, token, secret): #checks given oauth credentials oauth_verify_code = verifyOauth(token, secret) #checks if methods gave an error # if there is an error, returns an oauth error json if oauth_verify_code != 200: return oauth_error_json #calls method to get json array from documentdb based #on query parameters rec_json = getRecords(username, timestamp, prev, tags) if rec_json == 'error': #returns error json if there was an error #gettin the metadata return get_image_error_json #formats sucess json rtn_json = {'status': 'success', 'imgs': rec_json} #return success json return rtn_json
def deleteImageJSON(blobURL, token, secret): #checks given oauth credentials oauth_verify_code = verifyOauth(token, secret) #checks if methods gave an error # if there is an error, returns an oauth error json if oauth_verify_code != 200: return oauth_error_json #calls method to delete blob for Azure storage rtnBlobList = deleteBlob(blobURL) if rtnBlobList == 'error': #returns error json if there was an error #deleting the image return delete_image_blob_error_json #calls method to delete metadata from documentdb rtnDbMsg = deleteRecord(blobURL) if rtnDbMsg == 'error': #returns error json if there was an error #deleting the metadata return delete_image_db_error_json #return success json return delete_image_success_json
def updateTagsJSON(blobURL, tags, username, token, secret): oauth_verify_code = verifyOauth(token, secret) if oauth_verify_code != 200: return oauth_error_json return update_tags_success_json