From ecb5fa7120fec6fee91935efa35a23cacc32184a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20J=2E=20Schilling?= Date: Fri, 3 Nov 2023 11:19:17 +0100 Subject: [PATCH] OPTIONS request is not supported, changed to GET --- Dockerfile | 8 ++++++-- Makefile | 2 +- script/converter/from_csv.sh | 2 +- script/converter/from_xml.sh | 2 +- script/update.sh | 6 +++--- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6e00d338..046a2e6d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,11 @@ -FROM circleci/python:latest +FROM ubuntu:20.04 MAINTAINER Mathias Schilling -ENV APP_PATH /home/circleci/project +RUN apt update +RUN apt --assume-yes install curl +RUN apt --assume-yes install python3 + +ENV APP_PATH /app WORKDIR $APP_PATH \ No newline at end of file diff --git a/Makefile b/Makefile index 2ac88a87..54145118 100644 --- a/Makefile +++ b/Makefile @@ -20,5 +20,5 @@ run: ## Run the container in an interactive shell @docker run \ --rm \ -it \ - --volume ${PWD}:/home/circleci/project \ + --volume ${PWD}:/app \ "${STACK_SLUG}:${STACK_VERSION}" bash diff --git a/script/converter/from_csv.sh b/script/converter/from_csv.sh index b162c40f..4f335e2c 100755 --- a/script/converter/from_csv.sh +++ b/script/converter/from_csv.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from datetime import datetime from entity import Period, Rate, Response diff --git a/script/converter/from_xml.sh b/script/converter/from_xml.sh index dd5712a4..2fbc515a 100755 --- a/script/converter/from_xml.sh +++ b/script/converter/from_xml.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from datetime import datetime from entity import Period, Rate, Response diff --git a/script/update.sh b/script/update.sh index 738ab451..b2b769eb 100755 --- a/script/update.sh +++ b/script/update.sh @@ -6,7 +6,7 @@ readonly PROJECT_DIR=$(cd "${SCRIPT_DIR}/.." && pwd) readonly RATE_DIR=$(cd "${PROJECT_DIR}/rate" && pwd) readonly README=$(cat "$SCRIPT_DIR/README_TEMPLATE.md") -command -v python version >/dev/null 2>&1 || { +command -v python3 version >/dev/null 2>&1 || { echo >&2 "Please install python in your path before continuing." exit 1 } @@ -43,10 +43,10 @@ readonly HMRC_URL_01="https://www.trade-tariff.service.gov.uk/api/v2/exchange_ra readonly HMRC_URL_02="https://www.trade-tariff.service.gov.uk/api/v2/exchange_rates/files/monthly_xml_${NEXT_YYYY}-${NEXT_MM}.XML" HMRC_URL="${HMRC_URL_01}" -readonly STATUS_CODE_01=$(curl --silent -LI -X OPTIONS "${HMRC_URL_01}" -o /dev/null -w '%{http_code}') +readonly STATUS_CODE_01=$(curl --silent -LI -X GET "${HMRC_URL_01}" -o /dev/null -w '%{http_code}') if [ "$STATUS_CODE_01" != '200' ]; then - readonly STATUS_CODE_02=$(curl --silent -LI -X OPTIONS "${HMRC_URL_02}" -o /dev/null -w '%{http_code}') + readonly STATUS_CODE_02=$(curl --silent -LI -X GET "${HMRC_URL_02}" -o /dev/null -w '%{http_code}') if [ "$STATUS_CODE_02" != '200' ] then echo "No rates for ${NEXT_YYYY}-${NEXT_MM} available yet."