diff --git a/airbyte-config/init/src/main/resources/seed/source_definitions.yaml b/airbyte-config/init/src/main/resources/seed/source_definitions.yaml index fcd1c8de7d193..ea668a8ef224b 100644 --- a/airbyte-config/init/src/main/resources/seed/source_definitions.yaml +++ b/airbyte-config/init/src/main/resources/seed/source_definitions.yaml @@ -256,7 +256,7 @@ - name: Exchange Rates Api sourceDefinitionId: e2b40e36-aa0e-4bed-b41b-bcea6fa348b1 dockerRepository: airbyte/source-exchange-rates - dockerImageTag: 0.2.6 + dockerImageTag: 1.2.6 documentationUrl: https://docs.airbyte.io/integrations/sources/exchangeratesapi icon: exchangeratesapi.svg sourceType: api diff --git a/airbyte-config/init/src/main/resources/seed/source_specs.yaml b/airbyte-config/init/src/main/resources/seed/source_specs.yaml index d474589e35b34..e6fdbc2ee658e 100644 --- a/airbyte-config/init/src/main/resources/seed/source_specs.yaml +++ b/airbyte-config/init/src/main/resources/seed/source_specs.yaml @@ -2233,7 +2233,7 @@ supportsNormalization: false supportsDBT: false supported_destination_sync_modes: [] -- dockerImage: "airbyte/source-exchange-rates:0.2.6" +- dockerImage: "airbyte/source-exchange-rates:1.2.6" spec: documentationUrl: "https://docs.airbyte.io/integrations/sources/exchangeratesapi" connectionSpecification: @@ -2243,7 +2243,7 @@ required: - "start_date" - "access_key" - additionalProperties: false + additionalProperties: true properties: start_date: type: "string" @@ -2253,7 +2253,7 @@ - "YYYY-MM-DD" access_key: type: "string" - description: "Your API Access Key. See here. The key is case sensitive." airbyte_secret: true base: diff --git a/airbyte-integrations/connectors/source-exchange-rates/Dockerfile b/airbyte-integrations/connectors/source-exchange-rates/Dockerfile index 656dd2f828d74..8b81bb2107c88 100644 --- a/airbyte-integrations/connectors/source-exchange-rates/Dockerfile +++ b/airbyte-integrations/connectors/source-exchange-rates/Dockerfile @@ -16,5 +16,5 @@ RUN pip install . ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py" ENTRYPOINT ["python", "/airbyte/integration_code/main.py"] -LABEL io.airbyte.version=0.2.6 +LABEL io.airbyte.version=1.2.6 LABEL io.airbyte.name=airbyte/source-exchange-rates diff --git a/airbyte-integrations/connectors/source-exchange-rates/source_exchange_rates/source.py b/airbyte-integrations/connectors/source-exchange-rates/source_exchange_rates/source.py index 223f2e903a2b3..9b45a5d06a7d3 100644 --- a/airbyte-integrations/connectors/source-exchange-rates/source_exchange_rates/source.py +++ b/airbyte-integrations/connectors/source-exchange-rates/source_exchange_rates/source.py @@ -19,7 +19,7 @@ class ExchangeRates(HttpStream): date_field_name = "date" # HttpStream related fields - url_base = "http://api.exchangeratesapi.io/v1/" + url_base = "https://api.apilayer.com/exchangerates_data/" cursor_field = date_field_name primary_key = "" @@ -39,13 +39,18 @@ def next_page_token(self, response: requests.Response) -> Optional[Mapping[str, return None def request_params(self, **kwargs) -> MutableMapping[str, Any]: - params = {"access_key": self.access_key} + params = {} if self._base is not None: params["base"] = self._base return params + def request_headers(self, **kwargs) -> MutableMapping[str, Any]: + headers = {"apikey": self.access_key} + + return headers + def parse_response(self, response: requests.Response, **kwargs) -> Iterable[Mapping]: response_json = response.json() yield response_json @@ -82,12 +87,13 @@ def chunk_date_range(start_date: DateTime, ignore_weekends: bool) -> Iterable[Ma class SourceExchangeRates(AbstractSource): def check_connection(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> Tuple[bool, Any]: try: - params = {"access_key": config["access_key"]} + headers = {"apikey": config["access_key"]} + params = {} base = config.get("base") if base is not None: params["base"] = base - resp = requests.get(f"{ExchangeRates.url_base}{config['start_date']}", params=params) + resp = requests.get(f"{ExchangeRates.url_base}{config['start_date']}", params=params, headers=headers) status = resp.status_code logger.info(f"Ping response code: {status}") if status == 200: diff --git a/airbyte-integrations/connectors/source-exchange-rates/source_exchange_rates/spec.yaml b/airbyte-integrations/connectors/source-exchange-rates/source_exchange_rates/spec.yaml index adc25f06234ed..0ef6825fb1141 100644 --- a/airbyte-integrations/connectors/source-exchange-rates/source_exchange_rates/spec.yaml +++ b/airbyte-integrations/connectors/source-exchange-rates/source_exchange_rates/spec.yaml @@ -6,7 +6,7 @@ connectionSpecification: required: - start_date - access_key - additionalProperties: false + additionalProperties: true properties: start_date: type: string @@ -17,8 +17,8 @@ connectionSpecification: access_key: type: string description: >- - Your API Access Key. See here. The key is + Your API Key. See here. The key is case sensitive. airbyte_secret: true base: diff --git a/docs/integrations/sources/exchangeratesapi.md b/docs/integrations/sources/exchangeratesapi.md index 00ca77b98a190..e5f33ace327bb 100644 --- a/docs/integrations/sources/exchangeratesapi.md +++ b/docs/integrations/sources/exchangeratesapi.md @@ -46,6 +46,7 @@ If you have `free` subscription plan \(you may check it [here](https://manage.ex | Version | Date | Pull Request | Subject | |:--------| :--- | :--- | :--- | +| 1.2.6 | 2022-08-23 | [15884](https://github.com/airbytehq/airbyte/pull/15884) | Migrated to new API Layer endpoint | | 0.2.6 | 2022-04-20 | [12230](https://github.com/airbytehq/airbyte/pull/12230) | Update connector to use a `spec.yaml` | | 0.2.5 | 2021-11-12 | [7936](https://github.com/airbytehq/airbyte/pull/7936) | Add ignore_weekends boolean option | | 0.2.4 | 2021-11-08 | [7499](https://github.com/airbytehq/airbyte/pull/7499) | Remove base-python dependencies |