Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(http_api): put faillible imports in the try block #1805

Merged
merged 2 commits into from
Oct 28, 2024
Merged
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Unreleased

## [7.1.1] 2024-10-28

### Fix

- HTTP API: Missing dependencies for the HTTP API connector do not prevent the import of the lib anymore

## [7.1.0] 2024-10-28

### Changed
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "toucan-connectors"
version = "7.1.0"
version = "7.1.1"
description = "Toucan Toco Connectors"
authors = ["Toucan Toco <dev@toucantoco.com>"]
license = "BSD"
Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ sonar.organization=toucantoco

# This is the name and version displayed in the SonarCloud UI.
sonar.projectName=Toucan Connectors
sonar.projectVersion=7.1.0
sonar.projectVersion=7.1.1
sonar.python.version=3.11

# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
Expand Down
16 changes: 9 additions & 7 deletions toucan_connectors/http_api/http_api_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,24 @@
from enum import Enum
from logging import getLogger
from typing import Any, List
from xml.etree.ElementTree import ParseError, fromstring, tostring

from pydantic import AnyHttpUrl, BaseModel, Field, FilePath
from requests.exceptions import HTTPError

from toucan_connectors.http_api.http_api_data_source import HttpAPIDataSource, apply_pagination_to_data_source
from toucan_connectors.http_api.pagination_configs import (
NoopPaginationConfig,
extract_pagination_info_from_result,
)

try:
from xml.etree.ElementTree import ParseError, fromstring, tostring

import pandas as pd
from requests import Session
from requests.exceptions import HTTPError
from xmltodict import parse

from toucan_connectors.http_api.pagination_configs import (
NoopPaginationConfig,
extract_pagination_info_from_result,
)

CONNECTOR_OK = True
except ImportError as exc: # pragma: no cover
getLogger(__name__).warning(f"Missing dependencies for {__name__}: {exc}")
Expand Down Expand Up @@ -130,7 +132,7 @@ def do_request(self, query, session):
raise
return data

def perform_requests(self, data_source: HttpAPIDataSource, session: Session) -> list[Any]:
def perform_requests(self, data_source: HttpAPIDataSource, session: "Session") -> list[Any]:
results = []
# Extract first http_pagination_config from data_source
pagination_config = data_source.http_pagination_config or NoopPaginationConfig()
Expand Down