I’m using the client to make requests to an existing API - and so far it’s amazing!
One confusion I’ve run into though is that the paths don’t seem to be appended to the servers url. They are treated as absolute paths on the server.
If the servers url ends in /api/v1/ and a path entry is /article, I’d expect to see /api/v1/article - instead I see /article
The OpenAPI spec is clear that the paths will be appended to the server url.
Here’s an example.
title: Relative Paths
description: An example for relative paths
- url: https://example.com/rest/v1
description: Example API
summary: This path should be appended to the complete server URL.
from http.client import HTTPConnection
HTTPConnection.debuglevel = 1
logging.basicConfig() # you need to initialize logging, otherwise you will not see anything from requests
requests_log = logging.getLogger(“urllib3”)
requests_log.propagate = True
schema = open(os.path.join(
client = apistar.Client(schema=schema)
The debugging output shows:
“GET /relative/path HTTP/1.1” 404 606
Thanks in advance!