fix image load
This commit is contained in:
@@ -13,6 +13,7 @@ from email.mime.text import MIMEText
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
import datetime
|
||||
import jwt
|
||||
import requests
|
||||
|
||||
class BaseService:
|
||||
TRANSACTION_TYPE = None
|
||||
@@ -357,6 +358,38 @@ class BaseService:
|
||||
KafkaIntegration.send_loan_request(loan_data = loan_data, request_id = request_id, topic = topic)
|
||||
KafkaIntegration.flush()
|
||||
|
||||
@staticmethod
|
||||
def get_site_imges_data(provision_uid, primary_server, provision_port, selected_flavor):
|
||||
destination_server = "http://" + str(primary_server) + ":" + str(provision_port)
|
||||
api_url = destination_server + "/api/props"
|
||||
try:
|
||||
payload = {'provision_uid': provision_uid, 'flavor': selected_flavor}
|
||||
logger.info(f"api_url: {str(api_url)}")
|
||||
logger.info(f"selected_flavor: {str(selected_flavor)}")
|
||||
|
||||
# Make the GET request
|
||||
res_data = []
|
||||
response = requests.get(api_url, params=payload)
|
||||
if response.status_code == 200:
|
||||
logger.info(f"Response Site Images: {res_data}")
|
||||
# Convert the JSON response to a Python dictionary
|
||||
res_data = response.json()
|
||||
logger.info(f"Response Site Images: {res_data}")
|
||||
|
||||
response_data = {
|
||||
"provision_uid": provision_uid,
|
||||
"data": res_data,
|
||||
# "product_id": product_id,
|
||||
}
|
||||
|
||||
return response_data
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"An error occurred while get_site_imges_data data: {str(e)}", exc_info=True)
|
||||
return None
|
||||
|
||||
|
||||
|
||||
#
|
||||
# @classmethod
|
||||
# def calculate_charges(cls, offer, amount):
|
||||
|
||||
Reference in New Issue
Block a user