import boto3 from boto3.s3.transfer import TransferConfig from botocore import UNSIGNED from botocore.config import Config import json soracom_beam_endpoint = 'http://beam.soracom.io:18080' def invoke_endpoint(endpoint_name, hour, temperature, humidity): client = boto3.client('sagemaker-runtime', use_ssl=False, endpoint_url=soracom_beam_endpoint, config=Config(signature_version=UNSIGNED)) response = client.invoke_endpoint( EndpointName=endpoint_name, Body='{},{},{}'.format(hour, temperature, humidity), ContentType='text/csv', Accept='application/json' ) body = response['Body'] print(json.load(body)) # python -c "import sagemaker_invoke_endpoint; sagemaker_invoke_endpoint.invoke_endpoint(endpoint_name='sagemaker-xgboost-2023-01-24-04-29-35-481', hour=7, temperature=2, humidity=71)"