api-dock 0.2.1__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. {api_dock-0.2.1 → api_dock-0.2.2}/PKG-INFO +1 -1
  2. {api_dock-0.2.1 → api_dock-0.2.2}/api_dock/storage_auth.py +19 -12
  3. {api_dock-0.2.1 → api_dock-0.2.2}/api_dock.egg-info/PKG-INFO +1 -1
  4. {api_dock-0.2.1 → api_dock-0.2.2}/pyproject.toml +1 -1
  5. {api_dock-0.2.1 → api_dock-0.2.2}/LICENSE.md +0 -0
  6. {api_dock-0.2.1 → api_dock-0.2.2}/README.md +0 -0
  7. {api_dock-0.2.1 → api_dock-0.2.2}/api_dock/__init__.py +0 -0
  8. {api_dock-0.2.1 → api_dock-0.2.2}/api_dock/cli.py +0 -0
  9. {api_dock-0.2.1 → api_dock-0.2.2}/api_dock/config.py +0 -0
  10. {api_dock-0.2.1 → api_dock-0.2.2}/api_dock/config_discovery.py +0 -0
  11. {api_dock-0.2.1 → api_dock-0.2.2}/api_dock/database_config.py +0 -0
  12. {api_dock-0.2.1 → api_dock-0.2.2}/api_dock/fast_api.py +0 -0
  13. {api_dock-0.2.1 → api_dock-0.2.2}/api_dock/flask_api.py +0 -0
  14. {api_dock-0.2.1 → api_dock-0.2.2}/api_dock/route_mapper.py +0 -0
  15. {api_dock-0.2.1 → api_dock-0.2.2}/api_dock/sql_builder.py +0 -0
  16. {api_dock-0.2.1 → api_dock-0.2.2}/api_dock.egg-info/SOURCES.txt +0 -0
  17. {api_dock-0.2.1 → api_dock-0.2.2}/api_dock.egg-info/dependency_links.txt +0 -0
  18. {api_dock-0.2.1 → api_dock-0.2.2}/api_dock.egg-info/entry_points.txt +0 -0
  19. {api_dock-0.2.1 → api_dock-0.2.2}/api_dock.egg-info/requires.txt +0 -0
  20. {api_dock-0.2.1 → api_dock-0.2.2}/api_dock.egg-info/top_level.txt +0 -0
  21. {api_dock-0.2.1 → api_dock-0.2.2}/config/config.yaml +0 -0
  22. {api_dock-0.2.1 → api_dock-0.2.2}/config/databases/db_example.yaml +0 -0
  23. {api_dock-0.2.1 → api_dock-0.2.2}/config/remotes/remote_with_allowed_routes.yaml +0 -0
  24. {api_dock-0.2.1 → api_dock-0.2.2}/config/remotes/remote_with_custom_mapping.yaml +0 -0
  25. {api_dock-0.2.1 → api_dock-0.2.2}/config/remotes/remote_with_restrictions.yaml +0 -0
  26. {api_dock-0.2.1 → api_dock-0.2.2}/config/remotes/remote_with_wildcards.yaml +0 -0
  27. {api_dock-0.2.1 → api_dock-0.2.2}/setup.cfg +0 -0
  28. {api_dock-0.2.1 → api_dock-0.2.2}/tests/test_config_syntax.py +0 -0
  29. {api_dock-0.2.1 → api_dock-0.2.2}/tests/test_curl_fixes.py +0 -0
  30. {api_dock-0.2.1 → api_dock-0.2.2}/tests/test_restrictions.py +0 -0
  31. {api_dock-0.2.1 → api_dock-0.2.2}/tests/test_root_endpoint.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: api_dock
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: A flexible API gateway that allows you to proxy requests to multiple remote APIs and Databases
5
5
  Author-email: Brookie Guzder-Williams <bguzder-williams@berkeley.edu>
6
6
  License: BSd 3-clause
@@ -381,13 +381,14 @@ def _setup_http_support(conn: Any, metadata: Optional[Dict[str, Any]] = None) ->
381
381
  """Setup HTTP/HTTPS support.
382
382
 
383
383
  Installs httpfs extension for HTTP/HTTPS access. If metadata contains
384
- auth_headers or bearer_token, configures HTTP authentication.
384
+ auth_headers, bearer_token, or cookies, configures HTTP authentication.
385
385
 
386
386
  Args:
387
387
  conn: DuckDB connection object.
388
388
  metadata: Optional metadata dict that may contain:
389
389
  - bearer_token: Bearer token for Authorization header
390
390
  - auth_headers: Dict of custom HTTP headers
391
+ - cookies: Dict of cookies to send with requests
391
392
 
392
393
  Returns:
393
394
  True if setup succeeded, False if it failed.
@@ -402,20 +403,26 @@ def _setup_http_support(conn: Any, metadata: Optional[Dict[str, Any]] = None) ->
402
403
 
403
404
  # Setup HTTP authentication if provided
404
405
  bearer_token = metadata.get('bearer_token')
405
- auth_headers = metadata.get('auth_headers')
406
+ auth_headers = metadata.get('auth_headers', {})
407
+ cookies = metadata.get('cookies', {})
406
408
 
409
+ # Build headers dict
410
+ headers = dict(auth_headers) if auth_headers else {}
411
+
412
+ # Add bearer token to headers if provided
407
413
  if bearer_token:
408
- # Use bearer token authentication
409
- conn.execute(f"""
410
- CREATE OR REPLACE SECRET http_auth (
411
- TYPE http,
412
- BEARER_TOKEN '{bearer_token}'
413
- );
414
- """)
415
- elif auth_headers:
416
- # Use custom headers
414
+ headers['Authorization'] = f'Bearer {bearer_token}'
415
+
416
+ # Add cookies to headers if provided
417
+ # Cookies are sent via the Cookie header
418
+ if cookies:
419
+ cookie_str = '; '.join([f'{k}={v}' for k, v in cookies.items()])
420
+ headers['Cookie'] = cookie_str
421
+
422
+ # Create HTTP secret with headers if any are configured
423
+ if headers:
417
424
  # Convert dict to DuckDB MAP format
418
- headers_str = ', '.join([f"'{k}': '{v}'" for k, v in auth_headers.items()])
425
+ headers_str = ', '.join([f"'{k}': '{v}'" for k, v in headers.items()])
419
426
  conn.execute(f"""
420
427
  CREATE OR REPLACE SECRET http_auth (
421
428
  TYPE http,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: api_dock
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: A flexible API gateway that allows you to proxy requests to multiple remote APIs and Databases
5
5
  Author-email: Brookie Guzder-Williams <bguzder-williams@berkeley.edu>
6
6
  License: BSd 3-clause
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "api_dock"
7
- version = "0.2.1"
7
+ version = "0.2.2"
8
8
  description = "A flexible API gateway that allows you to proxy requests to multiple remote APIs and Databases"
9
9
  readme = "README.md"
10
10
  license = {text = "BSd 3-clause"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes