Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 61 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ py-aps is a Python SDK that provides a simple and intuitive interface for intera

- **Authentication**: Easy OAuth2 authentication flow
- **Data Management**: Access and manage files in BIM 360, ACC, and other Autodesk cloud storage
- **Automation**: Automate design and engineering workflows
- **Automation**: High-level workflow API for executing WorkItems with automatic file management and webhook support
- **Proxy Support**: HTTP/HTTPS proxy configuration for enterprise environments (v0.0.6+)

## Quick Start

Expand All @@ -43,7 +44,33 @@ projects = list(dm.hubs.list_projects(hub_id))
contents = list(dm.folders.contents(project_id, folder_id))
```

### Design Automation
### Automation (High-Level Workflow)
```python
from pyaps.automation import AutomationWorkflow

workflow = AutomationWorkflow(
automation_client=auto_client,
data_client=dm_client,
default_bucket="my-bucket",
)

# Execute WorkItem with automatic file management
result = workflow.run_workitem_with_files(
activity_id="Owner.MyActivity+prod",
input_files={"inputFile": "path/to/input.rvt"},
output_files={"outputFile": "output.rvt"},
)

# With webhooks (no polling required)
result = workflow.run_workitem_with_files(
activity_id="Owner.MyActivity+prod",
input_files={"inputFile": "input.rvt"},
output_files={"outputFile": "output.rvt"},
on_complete_url="https://myapp.com/webhook/complete",
)
```

### Automation (Low-Level API)
```python
from pyaps.automation import AutomationClient

Expand All @@ -52,25 +79,53 @@ auto = AutomationClient(token_provider=lambda: token.access_token)
# List engines
engines = auto.list_engines()

# Create and execute workitem
# Start workitem (manual setup required)
workitem = auto.start_workitem({
'activityId': 'Owner.MyActivity+prod',
'arguments': {...}
})
```

For more examples, see `src/pyaps/auth/example.py`, `src/pyaps/datamanagement/example.py`, and `src/pyaps/automation/example.py`.
### Proxy Configuration (v0.0.6+)
```python
# Explicit proxy configuration
client = AuthClient(
client_id="...",
client_secret="...",
proxies={
'http': 'http://proxy.company.com:8080',
'https': 'https://proxy.company.com:8080'
}
)

# Or use environment variables (HTTP_PROXY, HTTPS_PROXY)
client = AuthClient(
client_id="...",
client_secret="...",
trust_env=True # Default - reads from environment
)
```

For more examples and detailed documentation:
- **AutomationWorkflow Guide**: `src/pyaps/automation/WORKFLOW.md`
- **Workflow Examples**: `src/pyaps/automation/workflow_example.py`
- **Low-Level Examples**: `src/pyaps/automation/example.py`
- **Auth Examples**: `src/pyaps/auth/example.py`
- **Data Management Examples**: `src/pyaps/datamanagement/example.py`
- **Proxy Examples**: `src/pyaps/http/proxy_example.py`

## Project Status

**Current version: v0.0.4** - Design Automation API support added
**Current version: v0.0.6** - Proxy support for enterprise environments

This package is currently in early development. Active development is underway by **voidbox**.

<details>
<summary><b>Version History</b></summary>

- **v0.0.4** - Added Design Automation API client (Engines, AppBundles, Activities, WorkItems)
- **v0.0.6** - Added HTTP/HTTPS proxy support for enterprise environments (configurable via explicit settings or environment variables)
- **v0.0.5** - Added AutomationWorkflow high-level API with automatic file management, webhook support (onComplete/onProgress), batch processing, and comprehensive documentation
- **v0.0.4** - Added Automation API client (Engines, AppBundles, Activities, WorkItems)
- **v0.0.3** - Added Data Management API client (Hubs, Projects, Folders, Items, Versions, Buckets, Objects)
- **v0.0.2** - Added OAuth 2.0 authentication client with 2-legged/3-legged flows, PKCE support, and token management
- **v0.0.1** - Initial package release (placeholder)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "py-aps"
version = "0.0.5"
version = "0.0.6"
description = "Autodesk Platform Service APIs Python SDK"
readme = "README.md"
requires-python = ">=3.9"
Expand Down
21 changes: 21 additions & 0 deletions src/pyaps/auth/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,24 @@ def __init__(
user_agent: str = "pyaps-auth",
cache_prefix: str = "aps",
session: Optional[requests.Session] = None,
proxies: Optional[Dict[str, str]] = None,
trust_env: bool = True,
) -> None:
"""
Args:
client_id: APS Client ID
client_secret: APS Client Secret (2-legged 필수)
redirect_uri: Redirect URI (3-legged 필수)
store: Token storage implementation
auth_base_url: Authentication API base URL
userprofile_base_url: UserProfile API base URL
timeout: 요청 타임아웃 (초)
user_agent: User-Agent 헤더 값
cache_prefix: Cache key prefix
session: 커스텀 requests.Session (선택)
proxies: 프록시 설정 (선택)
trust_env: 환경 변수에서 프록시 읽기 (기본: True)
"""
self.client_id = client_id
self.client_secret = client_secret
self.redirect_uri = redirect_uri
Expand All @@ -56,13 +73,17 @@ def _token_provider() -> str:
user_agent=user_agent,
timeout=timeout,
session=session,
proxies=proxies,
trust_env=trust_env,
)
self.http_userprofile = HTTPClient(
_token_provider,
base_url=userprofile_base_url,
user_agent=user_agent,
timeout=timeout,
session=session,
proxies=proxies,
trust_env=trust_env,
)

# Public facades
Expand Down
14 changes: 14 additions & 0 deletions src/pyaps/automation/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,28 @@ def __init__(
user_agent: str = "pyaps-automation",
timeout: float = 30.0,
session: Optional[requests.Session] = None,
proxies: Optional[Dict[str, str]] = None,
trust_env: bool = True,
) -> None:
"""
Args:
token_provider: APS 액세스 토큰 제공 함수
region: Design Automation 리전 (us-east, eu-west)
user_agent: User-Agent 헤더 값
timeout: 요청 타임아웃 (초)
session: 커스텀 requests.Session (선택)
proxies: 프록시 설정 (선택)
trust_env: 환경 변수에서 프록시 읽기 (기본: True)
"""
base_url = f"https://developer.api.autodesk.com/da/{region}/v3"
self.http = HTTPClient(
token_provider,
base_url=base_url,
user_agent=user_agent,
timeout=timeout,
session=session,
proxies=proxies,
trust_env=trust_env,
)

# ------- ForgeApps -------
Expand Down
23 changes: 20 additions & 3 deletions src/pyaps/datamanagement/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,35 @@ def __init__(
timeout: float = 30.0,
user_agent: str = "pyaps-dm",
session: Optional[requests.Session] = None,
proxies: Optional[Dict[str, str]] = None,
trust_env: bool = True,
) -> None:
"""
Args:
token_provider: APS 액세스 토큰 제공 함수
project_base_url: Project API base URL
data_base_url: Data API base URL
oss_base_url: OSS API base URL
timeout: 요청 타임아웃 (초)
user_agent: User-Agent 헤더 값
session: 커스텀 requests.Session (선택)
proxies: 프록시 설정 (선택)
trust_env: 환경 변수에서 프록시 읽기 (기본: True)
"""
self.http_project = HTTPClient(
token_provider, base_url=project_base_url,
user_agent=user_agent, timeout=timeout, session=session
user_agent=user_agent, timeout=timeout, session=session,
proxies=proxies, trust_env=trust_env
)
self.http_data = HTTPClient(
token_provider, base_url=data_base_url,
user_agent=user_agent, timeout=timeout, session=session
user_agent=user_agent, timeout=timeout, session=session,
proxies=proxies, trust_env=trust_env
)
self.http_oss = HTTPClient(
token_provider, base_url=oss_base_url,
user_agent=user_agent, timeout=timeout, session=session
user_agent=user_agent, timeout=timeout, session=session,
proxies=proxies, trust_env=trust_env
)

# public facades
Expand Down
23 changes: 23 additions & 0 deletions src/pyaps/http/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class HTTPClient:
- 기본 JSON Accept/Content-Type 처리
- stream/raw/text/json 응답 모드 지원
- 간단한 재시도(backoff) 옵션
- 프록시 지원 (환경 변수 자동 감지 또는 명시적 설정)
"""

def __init__(
Expand All @@ -35,14 +36,36 @@ def __init__(
timeout: float = 30.0,
session: Optional[requests.Session] = None,
default_headers: Optional[Dict[str, str]] = None,
proxies: Optional[Dict[str, str]] = None,
trust_env: bool = True,
) -> None:
"""
Args:
token_provider: APS 액세스 토큰 제공 함수
base_url: API base URL (선택)
user_agent: User-Agent 헤더 값
timeout: 요청 타임아웃 (초)
session: 커스텀 requests.Session (선택)
default_headers: 기본 헤더 (선택)
proxies: 프록시 설정 (선택)
예: {'http': 'http://proxy.com:8080', 'https': 'https://proxy.com:8080'}
예: {'http': 'http://user:pass@proxy.com:8080'}
trust_env: 환경 변수(HTTP_PROXY, HTTPS_PROXY)에서 프록시 읽기 (기본: True)
"""
self._tp = token_provider
self.base_url = base_url.rstrip("/") if base_url else None
self.user_agent = user_agent
self.timeout = timeout
self.session = session or requests.Session()
self.default_headers = default_headers or {}

# 프록시 설정
if proxies:
self.session.proxies.update(proxies)

# 환경 변수에서 프록시 읽기 (trust_env=False이면 비활성화)
self.session.trust_env = trust_env

# ------------ low-level ------------
def _auth_headers(self, json_ct: bool = True) -> Dict[str, str]:
h = {
Expand Down
Loading