(wrapped, instance, args, kwargs)
| 126 | return |
| 127 | @wrapt.patch_function_wrapper(module, 'Client.__init__') |
| 128 | def init_wrapper(wrapped, instance, args, kwargs): |
| 129 | # Don't want to forward requests that are to Vertex AI, debug mode, or have their own http_options specified |
| 130 | # Thus, if the client constructor contains any params other than api_key, we don't set up forwarding |
| 131 | if any(value is not None for key, value in kwargs.items() if key != 'api_key'): |
| 132 | return wrapped(*args, **kwargs) |
| 133 | |
| 134 | default_metadata = { |
| 135 | "x-kaggle-proxy-data": os.environ['KAGGLE_DATA_PROXY_TOKEN'], |
| 136 | 'x-kaggle-authorization': f"Bearer {os.environ['KAGGLE_USER_SECRETS_TOKEN']}" |
| 137 | } |
| 138 | http_options = { |
| 139 | 'base_url': os.getenv('KAGGLE_DATA_PROXY_URL') + '/palmapi/', |
| 140 | 'headers': default_metadata |
| 141 | } |
| 142 | kwargs['http_options'] = http_options |
| 143 | return wrapped(*args, **kwargs) |
nothing calls this directly
no outgoing calls
no test coverage detected