Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ COPY pyproject.toml uv.lock ./
# Install dependencies into the system python environment.
RUN uv sync --frozen --no-dev

# Create a non-root user for security
RUN useradd -m -u 1000 apod && \
chown -R apod:apod /app
USER apod

# This makes 'gunicorn' and 'flask' available globally in the container
ENV PATH="/app/.venv/bin:$PATH"

Expand Down
6 changes: 4 additions & 2 deletions apod/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,10 @@ def get_concepts(request, text, apikey):

try:
LOG.debug("Getting response")
response = json.loads(request.get(cbase, fields=params))
clist = [concept["text"] for concept in response["concepts"]]
response = requests.get(cbase, params=params)
response.raise_for_status()
data = response.json()
clist = [concept["text"] for concept in data["concepts"]]
return {k: v for k, v in zip(range(len(clist)), clist)}

except Exception as ex:
Expand Down