Datatamer / tamr-client

Programmatically interact with Tamr
https://tamr-client.readthedocs.io
Apache License 2.0
11 stars 25 forks source link

Allow hitting API endpoints with scheme-like relative urls #491

Closed skalish closed 3 years ago

skalish commented 3 years ago

↪️ Pull Request

Addresses an error that occurs when trying to reach the versioned API endpoints instance:login and projects:import. Since these look like schemes, the function urljoin assumes they are the absolute URI. An additional, and not ideal, change has been made to still accommodate making requests with full URIs, so long as they have the same protocol (http, https, etc.) as is configured for the client instance.

💻 Examples

from tamr_unify_client import client
TAMR = client.Client(...)
TAMR.post("projects:import", json={...})

Before this PR, the underlying request would try to hit projects:import and fail with a requests.exceptions.InvalidSchema exception. With this PR the request will succeed.

An alternative to this PR is to provide the guidance that the API endpoints of the format abc:xyz must be worked around by formatting with a ./-prefix (./abc:xyz) or hit with and absolute URI.

✔️ PR Todo

github-actions[bot] commented 3 years ago

:tada: This PR is included in version 1.3.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: