Skip to content

Commit 1caf21f

Browse files
committed
Add user_agent parameter
Allows to set/override the http user agent in oauth2-client
1 parent 6b86c64 commit 1caf21f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

main/cloudfoundry_client/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ def __init__(self, target_endpoint: str, client_id: str = "cf", client_secret: s
138138
The passed string has to be a URL-Encoded JSON Object, containing the field origin with value as origin_key
139139
of an identity provider. Note that this identity provider must support the grant type password.
140140
See UAA API specifications
141+
:param user_agent: string. Can be used to set a custom http user agent
141142
"""
142143
proxy = kwargs.get("proxy", dict(http="", https=""))
143144
verify = kwargs.get("verify", True)
@@ -150,7 +151,7 @@ def __init__(self, target_endpoint: str, client_id: str = "cf", client_secret: s
150151
service_information = ServiceInformation(
151152
None, "%s/oauth/token" % info.authorization_endpoint, client_id, client_secret, [], verify
152153
)
153-
super(CloudFoundryClient, self).__init__(service_information, proxies=proxy)
154+
super(CloudFoundryClient, self).__init__(service_information, proxies=proxy, user_agent=kwargs.get("user_agent"))
154155
self.v2 = V2(target_endpoint_trimmed, self)
155156
self.v3 = V3(target_endpoint_trimmed, self)
156157
self._doppler = (

0 commit comments

Comments
 (0)