api-dock 0.4.9__tar.gz → 0.5.0__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 (30) hide show
  1. {api_dock-0.4.9 → api_dock-0.5.0}/PKG-INFO +1 -1
  2. {api_dock-0.4.9 → api_dock-0.5.0}/api_dock/storage_auth.py +39 -1
  3. {api_dock-0.4.9 → api_dock-0.5.0}/api_dock.egg-info/PKG-INFO +1 -1
  4. {api_dock-0.4.9 → api_dock-0.5.0}/pyproject.toml +1 -1
  5. {api_dock-0.4.9 → api_dock-0.5.0}/LICENSE.md +0 -0
  6. {api_dock-0.4.9 → api_dock-0.5.0}/README.md +0 -0
  7. {api_dock-0.4.9 → api_dock-0.5.0}/api_dock/__init__.py +0 -0
  8. {api_dock-0.4.9 → api_dock-0.5.0}/api_dock/auth.py +0 -0
  9. {api_dock-0.4.9 → api_dock-0.5.0}/api_dock/cli.py +0 -0
  10. {api_dock-0.4.9 → api_dock-0.5.0}/api_dock/config.py +0 -0
  11. {api_dock-0.4.9 → api_dock-0.5.0}/api_dock/config_discovery.py +0 -0
  12. {api_dock-0.4.9 → api_dock-0.5.0}/api_dock/database_config.py +0 -0
  13. {api_dock-0.4.9 → api_dock-0.5.0}/api_dock/encryption.py +0 -0
  14. {api_dock-0.4.9 → api_dock-0.5.0}/api_dock/fast_api.py +0 -0
  15. {api_dock-0.4.9 → api_dock-0.5.0}/api_dock/flask_api.py +0 -0
  16. {api_dock-0.4.9 → api_dock-0.5.0}/api_dock/route_mapper.py +0 -0
  17. {api_dock-0.4.9 → api_dock-0.5.0}/api_dock/sql_builder.py +0 -0
  18. {api_dock-0.4.9 → api_dock-0.5.0}/api_dock.egg-info/SOURCES.txt +0 -0
  19. {api_dock-0.4.9 → api_dock-0.5.0}/api_dock.egg-info/dependency_links.txt +0 -0
  20. {api_dock-0.4.9 → api_dock-0.5.0}/api_dock.egg-info/entry_points.txt +0 -0
  21. {api_dock-0.4.9 → api_dock-0.5.0}/api_dock.egg-info/requires.txt +0 -0
  22. {api_dock-0.4.9 → api_dock-0.5.0}/api_dock.egg-info/top_level.txt +0 -0
  23. {api_dock-0.4.9 → api_dock-0.5.0}/config/config.yaml +0 -0
  24. {api_dock-0.4.9 → api_dock-0.5.0}/config/databases/db_example.yaml +0 -0
  25. {api_dock-0.4.9 → api_dock-0.5.0}/config/databases/test_users.yaml +0 -0
  26. {api_dock-0.4.9 → api_dock-0.5.0}/config/remotes/remote_with_allowed_routes.yaml +0 -0
  27. {api_dock-0.4.9 → api_dock-0.5.0}/config/remotes/remote_with_custom_mapping.yaml +0 -0
  28. {api_dock-0.4.9 → api_dock-0.5.0}/config/remotes/remote_with_restrictions.yaml +0 -0
  29. {api_dock-0.4.9 → api_dock-0.5.0}/config/remotes/remote_with_wildcards.yaml +0 -0
  30. {api_dock-0.4.9 → api_dock-0.5.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: api_dock
3
- Version: 0.4.9
3
+ Version: 0.5.0
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
@@ -211,7 +211,7 @@ def _setup_s3_auth(conn: Any, metadata: Optional[Dict[str, Any]] = None) -> bool
211
211
 
212
212
  Args:
213
213
  conn: DuckDB connection object.
214
- metadata: Optional metadata dict that may contain 'region' key.
214
+ metadata: Optional metadata dict that may contain 'region' key and 'public' flag.
215
215
 
216
216
  Returns:
217
217
  True if setup succeeded, False if it failed (but query may still work with public files).
@@ -225,6 +225,9 @@ def _setup_s3_auth(conn: Any, metadata: Optional[Dict[str, Any]] = None) -> bool
225
225
  conn.execute("INSTALL aws;")
226
226
  conn.execute("LOAD aws;")
227
227
 
228
+ # Check if this is explicitly marked as public access
229
+ is_public = metadata.get('public', False)
230
+
228
231
  # Determine AWS region with priority:
229
232
  # 1. Config file metadata (most specific)
230
233
  # 2. Environment variables
@@ -235,6 +238,30 @@ def _setup_s3_auth(conn: Any, metadata: Optional[Dict[str, Any]] = None) -> bool
235
238
  os.environ.get('AWS_REGION')
236
239
  )
237
240
 
241
+ # For public buckets, try anonymous access first
242
+ if is_public:
243
+ try:
244
+ if aws_region:
245
+ conn.execute(f"""
246
+ CREATE OR REPLACE SECRET (
247
+ TYPE s3,
248
+ KEY_ID '',
249
+ SECRET '',
250
+ REGION '{aws_region}'
251
+ );
252
+ """)
253
+ else:
254
+ conn.execute("""
255
+ CREATE OR REPLACE SECRET (
256
+ TYPE s3,
257
+ KEY_ID '',
258
+ SECRET ''
259
+ );
260
+ """)
261
+ return True
262
+ except Exception:
263
+ pass # Fall through to credential chain
264
+
238
265
  # Configure S3 authentication using AWS credential chain
239
266
  # This automatically discovers credentials from:
240
267
  # - Environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN)
@@ -308,6 +335,17 @@ def _setup_gcs_auth(conn: Any, metadata: Optional[Dict[str, Any]] = None) -> boo
308
335
  # Set environment variable for this session
309
336
  os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = service_account
310
337
 
338
+ # Check if this is explicitly marked as public access
339
+ is_public = metadata.get('public', False)
340
+
341
+ # For public buckets, try anonymous access first
342
+ if is_public:
343
+ try:
344
+ # GCS public access doesn't require credentials
345
+ return True
346
+ except Exception:
347
+ pass # Fall through to credential chain
348
+
311
349
  # Configure GCS authentication
312
350
  if key_id and secret:
313
351
  # Use explicit HMAC credentials from config
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: api_dock
3
- Version: 0.4.9
3
+ Version: 0.5.0
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.4.9"
7
+ version = "0.5.0"
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
File without changes