python: upgrading from 1.9.2 to 1.9.6 gives redirects with changing schemes error
- Dominant language
- C#
- Stars
- 3.8k
- Forks
- 333
- Avg merge
- 16h 29m
- Merged PRs (30d)
- 116
Description
### What are you generating using Kiota, clients or plugins?
API Client/SDK
### In what context or format are you using Kiota?
Nuget tool
### Client library/SDK language
Python
### Describe the bug
Calling previously working API, now getting:
Redirects with changing schemes not allowed by default.
You can change this by modifying the allow_redirect_on_scheme_change request option.
### Expected behavior
Existing call should still work
### How to reproduce
Current code looks like this.
The HttpOverrideAzureIdentityAuthenticationProvider class implements this workaround for the "only https is supported" problem: https://github.com/microsoft/kiota/issues/5486#issuecomment-2384125823
#5486
```
http_client = httpx.AsyncClient(verify = False, follow_redirects = True)
http_client = KiotaClientFactory.create_with_default_middleware(http_client)
auth_provider = HttpOverrideAzureIdentityAuthenticationProvider(
credential, scopes=my_scope)
request_adapter = HttpxRequestAdapter(
http_client = http_client,
authentication_provider = auth_provider,
base_url = self.base_url)
return request_adapter
```
Also on some APIs I'm now getting "Valid url scheme and host required" with a naked path without the base url, as if passing the base url in the request adaptor is no longer effective.
### Open API description file
sorry - can't provide
### Kiota Version
1.9.6
### Latest Kiota version known to work for scenario above?(Not required)
1.9.2
### Known Workarounds
Unless a new feature has been added, I assume HttpOverrideAzureIdentityAuthenticationProvider is still needed?
What are the details in how to add `allow_redirect_on_scheme_change` to the middleware?
If want to make sure I keep the retry behavior in the default middleware if I override -but if needed I can always handle with polly from the outside.
### Configuration
Windows x64
### Debug output
Click to expand log
```
```
### Other information
_No response_
Contributor guide
Research direction
Start with HttpxRequestAdapter and KiotaClientFactory.create_with_default_middleware, comparing behavior between Kiota 1.9.2 and 1.9.6. Reproduce the scheme-change redirect and naked-path cases using the shown AsyncClient configuration and HttpOverrideAzureIdentityAuthenticationProvider; done means existing calls work without losing default retry behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100