Commit 973d7631 authored by harshit aggarwal's avatar harshit aggarwal
Browse files

Revert "Merge branch 'feature/azure-file-handing' into 'master'"

This reverts merge request !11
parent add0c805
Pipeline #85566 passed with stages
in 2 minutes and 32 seconds
......@@ -19,7 +19,6 @@ import dataclasses
import io
import json
import logging
import os
from typing import List, Tuple
import requests
......@@ -27,7 +26,7 @@ import tenacity
from osdu_api.auth.authorization import TokenRefresher, authorize
from osdu_api.providers import blob_storage
from osdu_api.providers.types import BlobStorageClient, FileLikeObject
from osdu_api.utils.request import request_raiser
from osdu_ingestion.libs.constants import RETRIES, WAIT
from osdu_ingestion.libs.context import Context
from osdu_ingestion.libs.exceptions import InvalidFileRecordData
......@@ -124,13 +123,6 @@ class FileHandler(HeadersMixin):
unsigned_url=None,
kind=None)
@tenacity.retry(**RETRY_SETTINGS)
@authorize()
def _send_get_request(self, headers: dict, url: str) -> requests.Response:
response = requests.get(url, headers=headers)
logger.debug(response)
return response
@tenacity.retry(**RETRY_SETTINGS)
@authorize()
def _send_post_request(self, headers: dict, url: str, request_body: str) -> requests.Response:
......@@ -140,14 +132,10 @@ class FileHandler(HeadersMixin):
return response
@tenacity.retry(**RETRY_SETTINGS)
@request_raiser
def _send_put_request(self, headers: dict, url: str, request_body: str) -> requests.Response:
if os.getenv("CLOUD_PROVIDER") == "azure":
headers["x-ms-blob-type"] = "BlockBlob"
logger.debug(f"{request_body}")
response = requests.put(url, request_body, headers=headers)
logger.debug(response.content)
@authorize()
def _send_get_request(self, headers: dict, url: str) -> requests.Response:
response = requests.get(url, headers=headers)
logger.debug(response)
return response
def _get_upload_signed_url(self, headers: dict) -> FileUploadUrlResponse:
......@@ -199,7 +187,7 @@ class FileHandler(HeadersMixin):
"""
logger.debug("Uploading file.")
buffer.seek(0)
self._send_put_request(headers, signed_url, buffer.read())
requests.put(signed_url, buffer.read(), headers=headers)
logger.debug("File uploaded.")
def _get_file_location_request(self, headers: dict, file_id: str) -> str:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment