Skip to content

Commit

Permalink
fix(bootstrapper): bootstrapper should use httpx (#45)
Browse files Browse the repository at this point in the history
* Use httpx

* Update print statement
  • Loading branch information
abarciauskas-bgse committed Jun 12, 2023
1 parent b56aaad commit 36bb361
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/bootstrapper/runtime/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RUN echo "Using PGSTAC Version ${PGSTAC_VERSION}"

WORKDIR /tmp

RUN pip install requests psycopg[binary,pool] pypgstac==${PGSTAC_VERSION} -t /asset
RUN pip install httpx psycopg[binary,pool] pypgstac==${PGSTAC_VERSION} -t /asset

COPY runtime/handler.py /asset/handler.py

Expand Down
6 changes: 3 additions & 3 deletions lib/bootstrapper/runtime/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import boto3
import psycopg
import requests
import httpx
from psycopg import sql
from psycopg.conninfo import make_conninfo
from pypgstac.db import PgstacDB
Expand Down Expand Up @@ -58,10 +58,10 @@ def send(
headers = {"content-type": "", "content-length": str(len(json_responseBody))}

try:
response = requests.put(responseUrl, data=json_responseBody, headers=headers)
response = httpx.put(responseUrl, data=json_responseBody, headers=headers)
print("Status code: " + response.reason)
except Exception as e:
print("send(..) failed executing requests.put(..): " + str(e))
print("send(..) failed executing httpx.put(..): " + str(e))


def get_secret(secret_name):
Expand Down

0 comments on commit 36bb361

Please sign in to comment.