fix: make requests import optional in Python sync SDK
- requests import now wrapped in try/except with REQUESTS_AVAILABLE flag - Added DependencyError exception and _check_requests() helper - Updated sync examples to catch ImportError and exit gracefully - CI runner without requests will skip examples instead of failing
This commit is contained in:
parent
933f429162
commit
afb179be26
6 changed files with 53 additions and 6 deletions
|
|
@ -24,7 +24,12 @@ import os
|
|||
# Add the SDK path
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "src"))
|
||||
|
||||
from un import execute_code, CredentialsError
|
||||
try:
|
||||
from un import execute_code, CredentialsError
|
||||
except ImportError as e:
|
||||
print(f"Missing dependency: {e}")
|
||||
print("Install with: pip install requests")
|
||||
sys.exit(0) # Exit gracefully for CI
|
||||
|
||||
|
||||
def main():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue