You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I liberally used AI Models to help with the organization of this issue; it's a real use case motivated by Open Library (which requires http_proxy in order to make network requests)
Summary
Two independent gaps prevent AmazonCreatorsApi from routing traffic through an HTTP proxy.
Problem 1 — no proxy parameter on AmazonCreatorsApi
AmazonCreatorsApi.__init__ creates ApiClient without a Configuration, so configuration.proxy is always None. RESTClientObject already handles urllib3.ProxyManager
when configuration.proxy is set — the plumbing is there, it just isn't reachable from the
public API.
Problem 2 — OAuth2TokenManager.refresh_token() bypasses proxy entirely
Even if configuration.proxy were set, token refresh would still go direct:
This bare requests.post() has no proxy configuration. Token refresh on a cold cache
(worker restart, token expiry) cannot be routed through an authenticated proxy.
Real-world context
Open Library (Internet Archive) runs behind an authenticated Squid proxy. Adding Creators API
support required two separate workarounds to paper over both gaps:
Both hacks could be removed if proxy support were native to the library.
Proposed fix
Add proxy: str | None = None to AmazonCreatorsApi.__init__ (e.g. "http://user:pass@proxy:3128"),
pass it to ApiClient via a Configuration object, and have OAuth2TokenManager use a requests.Session with .proxies set when a proxy URL is provided.
The Configuration class and RESTClientObject already have the right structure — this is
purely a wiring change.
Will proactively submit a PR for your consideration
Note
I liberally used AI Models to help with the organization of this issue; it's a real use case motivated by Open Library (which requires http_proxy in order to make network requests)
Summary
Two independent gaps prevent
AmazonCreatorsApifrom routing traffic through an HTTP proxy.Problem 1 — no proxy parameter on
AmazonCreatorsApiAmazonCreatorsApi.__init__createsApiClientwithout aConfiguration, soconfiguration.proxyis alwaysNone.RESTClientObjectalready handlesurllib3.ProxyManagerwhen
configuration.proxyis set — the plumbing is there, it just isn't reachable from thepublic API.
Problem 2 —
OAuth2TokenManager.refresh_token()bypasses proxy entirelyEven if
configuration.proxywere set, token refresh would still go direct:This bare
requests.post()has no proxy configuration. Token refresh on a cold cache(worker restart, token expiry) cannot be routed through an authenticated proxy.
Real-world context
Open Library (Internet Archive) runs behind an authenticated Squid proxy. Adding Creators API
support required two separate workarounds to paper over both gaps:
rest_clientafter constructionOAuth2TokenManagerto overriderefresh_token()with a proxy-awarerequests.SessionBoth hacks could be removed if proxy support were native to the library.
Proposed fix
Add
proxy: str | None = NonetoAmazonCreatorsApi.__init__(e.g."http://user:pass@proxy:3128"),pass it to
ApiClientvia aConfigurationobject, and haveOAuth2TokenManageruse arequests.Sessionwith.proxiesset when a proxy URL is provided.The
Configurationclass andRESTClientObjectalready have the right structure — this ispurely a wiring change.
Will proactively submit a PR for your consideration