def delete_media_by_id(self, id): """Does a DELETE request to /media/{id}. Delete media results. It returns the status of the operation. Args: id (string): The id of the media. Returns: MediaByIdResponse: Response from the API. Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request. """ # The base uri for api requests query_builder = Configuration.BASE_URI # Prepare query string for API call query_builder += "/media/{id}" # Process optional template parameters query_builder = APIHelper.append_url_with_template_parameters(query_builder, { "id": id }) # Validate and preprocess url query_url = APIHelper.clean_url(query_builder) #append custom auth authorization CustomAuthUtility.appendCustomAuthParams(headers) # Prepare and invoke the API call request to fetch the response unirest.timeout(20) response = unirest.delete(query_url, headers=headers) # Error handling using HTTP status codes if response.code < 200 or response.code > 206: # 200 = HTTP OK print response.body raise APIException("HTTP Response Not OK", response.code, response.body) # Try to cast response to desired type if isinstance(response.body, dict): print "Media ID Deleted"