Skip to content
This repository has been archived by the owner on Jan 21, 2023. It is now read-only.

StructurizrClient.get_workspace() breaks on request.url.full_path #38

Closed
yt-ms opened this issue Oct 18, 2020 · 3 comments
Closed

StructurizrClient.get_workspace() breaks on request.url.full_path #38

yt-ms opened this issue Oct 18, 2020 · 3 comments

Comments

@yt-ms
Copy link
Collaborator

yt-ms commented Oct 18, 2020

Problem description

When invoking StructurizrClient.get_workspace(), an error occurs because httpx.URL does not have an attribute full_path.

Checking the source, this definitely does not exist.

Code Sample

Create a minimal, complete, verifiable example.

from structurizr.api import StructurizrClientSettings, StructurizrClient
settings = StructurizrClientSettings(url="http://a.b.c.com:8080/api", workspace_id=1, api_key="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", api_secret="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", user="structurizr")
client = StructurizrClient(settings=settings)
client.get_workspace()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\users\tordoff\dev\structurizr-python\src\structurizr\api\structurizr_client.py", line 136, in get_workspace
    request.headers.update(self._add_headers(request.url.full_path))
AttributeError: 'URL' object has no attribute 'full_path'

Context

System Information
==================
OS         Windows
OS-release      10
Python       3.7.5

Package Versions
================
depinfo                                 1.5.4
httpx                                  0.15.3
ordered-set                               3.1
pip                                    20.2.3
pydantic                                1.6.1
python-dotenv                          0.14.0
setuptools                             41.2.0
structurizr-python 0.0.1rc4+98.g8268b96.dirty
@yt-ms yt-ms changed the title StructurizrClient.get_workspace breaks on request.url.full_path StructurizrClient.get_workspace() breaks on request.url.full_path Oct 18, 2020
@Midnighter
Copy link
Owner

It's still in the docs https://www.python-httpx.org/api/#url this is strange.

@Midnighter
Copy link
Owner

Okay, probably happened in the 0.15 release if I follow changes in this encode/httpx#1275

@yt-ms
Copy link
Collaborator Author

yt-ms commented Oct 18, 2020

Yeah, after a bit of experimentation, request.url.raw_path.decode('ascii') seems to do the trick. I'll create a PR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants