Metadata-Version: 2.1
Name: wh2api
Version: 1.0.8
Summary: wormhole API for Python
Home-page: https://wormholepipeline.com
Author: C2monster
Author-email: contact@c2monster.com
License: UNKNOWN
Keywords: wormhole,sdk,wh_api
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Requires-Python: >=2
Description-Content-Type: text/markdown

# Wormhole API for python

### 업데이트 내용
## 1.0.1 (wormhole_version : 1.4.0)
1.  하위 python 2.7에서 대응이 가능하도록 모듈의 import방식변경
    - 기존에 모듈 import끼리 충돌 현상 발생으로 변경
2.  Wh클래스 이름 login으로 변경
    - wh2api.wh.Login(url,id,pw)형태로 변경 
3. project.read에서 조회 버그 수정

## 1.0.2 (wormhole_version : 1.5.0)
1. 관리를 위한 로직을 변경했습니다. (일반사용자는 변경 되는 부분 없음)
    - api_list 추가
    - requests 모듈 한군데에서 작동되도록 변경
2. Task idx만으로 Task의 상세 데이터 조회가 가능해졌습니다. 
    ```python
    wh2api.shot_task.read(task_idx)
    wh2api.asset_task.read(task_idx)
    ```
3. version업로드 시 등록 할 수 있는 옵션이 추가되었습니다.
    - Description 추가
    - cc옵션 추가
    - metadata 옵션 추가
    - 1개의 버전에 여러개의 파일을 업로드 할 수 있습니다.
        - version_path에 list[]형태로 입력해 줍니다.
        - version_path의 첫번째 version은 화면에 가장 처음 표시됩니다.
4. thumbnail_up이름을 thumbnail_update로 변경
    - shot / Asset의 썸네일 업데이트시 함수명이 변경되었습니다.
        
5. publish APi 추가
    - publish_path의 유효성 검사를 진행 합니다.
    - 필수 입력은 (Task_idx,which,version_idx,Task_Status_idx,Version_status_idx,Publish_path_list)

## 1.0.3 (wormhole_version : 1.7.0)
1. 로직 변경
    - Requests 모듈 뿐 아니라 기본 모듈인 urllib2,urllib3도 지원 합니다.
    
2. 로그인 방식 변경
    - 토큰만으로도 로그인 가능
    
3. 모듈
    - SHot / Asset list 조회 파라메터 변경
    - Shot / Asset bulk_creat 추가(9,10)
    - Task bulk_create 추가

4. json 출력 포맷 변경

    - 예) shot_name='s0010', shot_idx='1'  >>> shots: {name='s0010',idx='1'}
### 변경 전
```json
{
  "shots": [
    { "shot_idx": "1", "name": "s0010_c0010", "shot_order": "1" },
    { "shot_idx": "2", "name": "s0010_c0020", "shot_order": "2" },
    { "shot_idx": "3", "name": "s0010_c0030", "shot_order": "3" },
    { "shot_idx": "4", "name": "s0010_c0040", "shot_order": "4" },
    { "shot_idx": "5", "name": "s0010_c0050", "shot_order": "5" },
    { "shot_idx": "6", "name": "s0010_c0060", "shot_order": "6" },
    { "shot_idx": "7", "name": "s0010_c0070", "shot_order": "7" },
    { "shot_idx": "8", "name": "s0010_c0080", "shot_order": "8" },
    { "shot_idx": "9", "name": "s0010_c0090", "shot_order": "9" },
    { "shot_idx": "10", "name": "s0010_c0100", "shot_order": "10" }
```


### 변경 후 
```json
{
  "shots": [
    { "idx": "1", "name": "s0010_c0010", "order": "1" },
    { "idx": "2", "name": "s0010_c0020", "order": "2" },
    { "idx": "3", "name": "s0010_c0030", "order": "3" },
    { "idx": "4", "name": "s0010_c0040", "order": "4" },
    { "idx": "5", "name": "s0010_c0050", "order": "5" },
    { "idx": "6", "name": "s0010_c0060", "order": "6" },
    { "idx": "7", "name": "s0010_c0070", "order": "7" },
    { "idx": "8", "name": "s0010_c0080", "order": "8" },
    { "idx": "9", "name": "s0010_c0090", "order": "9" },
    { "idx": "10", "name": "s0010_c0100", "order": "10" }
  ]
}

```
## 1.0.5 (wormhole_version : 1.15.8)
1. Shot/Asset Read 모듈 변경 및 추가
    - Shot/Asset 의 index만 가지고 있으면 해당 Shot/Asset의 정보를 불러올 수 있습니다.
    - Custom Colume의 정보를 가져올 수 있게 변경 되었습니다. 

## 1.0.6 (wormhole_version : 1.15.8) - 빌드 문제로 설치금지
1. Python 3의 urllib3모듈관련 버그 수정
    - Get Request에서 필드 데이터 처리 방식이 변경 되었습니다.
```
삭제 getdata = urllib3.request.urlencode(data)

수정 전 result = http.request('Get', url=wh.Login.url + api + '?'+ gestdata, headers={"cookie":wh_token})
수정 후 result = http.request('Get', url=wh.Login.url + api + '?',fields=data, headers={"cookie":wh_token})

```
## 1.0.7 (wormhole_version : 1.15.8)
1. 재 빌드 1.0.6 변경 사항 유지

## 1.0.8(WORMHOLE_VERSION: 1.16.X)
1. 버그 픽스 
2. Track API 추가

## 사용방법

## 1. install
웜홀 api는 python3이상에서 원활하게 작동 됩니다. 
pip의 최신버전으로 업데이트 후 설치 하시기 바랍니다. 
```
pip install --upgrade pip
```
pip패키지 install(필수)
```
pip install wh2api #웜홀 API
pip install requests
pip install json
```

## 3. 패키지 import

```python
from wh2api import wh
import wh2api
```
## 4. 모듈 첫사용시

```python
wh.Login('http://host','id','pw')
#로그인 성공시 whtoken을 "Login.whtoken"라는 클래스 변수로 가지고 있음
```

## 4-1. 토큰 로그인 

```python
wh.Login('http://host','id',wh_token = "login_token") 
#로그인 성공시 받은 wh_token을 넣으면 로그인이됨

#사용방법
wh = wh.Login('http://host','id','pw')
wh_token = wh.whtoken['whtoken']

#토큰을 아는경우
wh = wh.Login('http://host','id',wh_token = wh_token)
```

## 5. project
- project.list
```python
wh2api.project.list(finished="")
    # finished = '1' 끝난 프로젝트도 조회
    # 웜홀에 있는 모든 프로젝트를 조회
```

-  project.read
```python
wh2api.project.read(project_idx)
    #Porject의 상세 내용 조회
    #버전업 및 퍼블리시 저장 경로 조회
    #진행 상황 조회
```


## 6. episode
-  episode.list
```python
wh2api.episode.list(project_idx)
    #프로젝트 내부 에피소드 리스트 조회
```


- episode.create
```python
wh2api.episode.create(project_idx,episode_name,description="")
    #에피소드 생성
```

## 7. sequence
- list
```python
wh2api.sequence.list(project_idx,episode_idx)
    #에피소드 내부 시퀀스 리스트 조회
```
- create
wh.sequence.create(project_idx,episode_idx,sequence_name,description="")
    #시퀀스 생성

## 8. shot
- list
```python
wh2api.shot.list(project_idx,episode_idx,sequence_idx)
    #시퀀스 내부 샷 리스트 조회
```

- read
```python
wh2api.shot.read(shot_idx)
    #특정 샷의 세부내용 조회
```

- create
```python
wh2api.shot.create(project_idx,episode_idx,sequence_idx,shot_name,description="",status_idx="1")
    #샷 생성
    #status_idx 비어있을때 기본값 1번
```

- thumbnail_update
```python
wh2api.shot.thumbnail_update(project_idx,shot_idx,thumbnail_path)
    #특정샷의 썸네일 업로드
    #Thubmnail_path 입력시 윈도우는 'r'을 붙혀서 업로드 해야 오류 없음
    #ex) r'H:\c2mosnter\test.jpg'
    #지원 포맷 *.jpg, *.png
```

- overview
```python
wh2api.shot.overview(project_idx,episode_idx="")
    #overview페이지 조회
    #episode가 비어있는경우 프로젝트 전체조회
```

- relation
```python
wh2api.shot.relation(project_idx,episode_idx)
    #샷에 연관된 에셋의 목록 조회
    #웜홀의 Relation페이지 연동
```

## 9. shot_Task
- list
```python
wh2api.shot_task.list(project_idx,shot_idx)
    #샷 내부의 Task조회
```

- create
```python
wh2api.shot_task.create(project_idx,shot_idx,tasktype_name)
    #샷내부에 Task 생성
    #중복 될경우 에러 발생
```

- bulk_create
```python
wh2api.shot_task.bulk_create(project_idx,shot_idx=[],tasktype_name=[])
#shot_idx와 tasktype_name을 똑같은 수를 배열로 보내야함
#ex)
shot_idx = [1,1,1,1,2,2,2,2]
tasktype = ['comp','animation','fx','final','comp','animation','fx','final']
#인덱스가 1,2번인 샷에 'comp','animation','fx','final' 4개의 테스크를 각각 등록

```

- status_change
```python
wh2api.shot_task.status_change(project_idx,task_idx,status_idx)
    #특정 Task의 Task Staus를 변경
```

- start
```python
wh2api.shot_task.start(project_idx,task_idx)
    #Task Start(MyTask>Todo)
```

- stop
```python
wh2api.shot_task.stop(project_idx,task_idx)
    #Task Stop(MyTask>Todo)
```

## 10. category
- list
```python
wh2api.category.list(project_idx)
    #프로젝트 내부에 Asset의 Category조회
```

- create
```python
wh2api.category.create(project_idx,category_name,description="")
    #Category생성
```

## 11. Asset
- list
```python
wh2api.asset.list(project_idx,category_idx)
    #특정 Category의 Asset 조회
```
- read
```python
wh2api.asset.read(asset_idx)
    #특정 에셋의 세부내용 조회
```
- create
```python
wh2api.asset.create(project_idx,category_idx,asset_name,description="",status_idx="1")
    #Asset생성
```

- thumbnail_update
```python
wh2api.asset.thumbnail_update(project_idx,asset_idx,thumbnail_path)
    #특정 Asset의 썸네일 업로드
    #Thubmnail_path 입력시 윈도우는 'r'을 붙혀서 업로드 해야 오류 없음
    #ex) r'H:\c2mosnter\test.jpg'
    #지원 포맷 *.jpg, *.png
```

- overview
```python
wh2api.asset.overview(project_idx,category_idx="")
    #Asset Overview조회
```

## 12. asset_Task
- list
```python
wh2api.asset_task.list(project_idx,asset_idx)
    #에셋 내부의 Task조회
```

- create
```python
wh2api.asset_task.create(project_idx,asset_idx,tasktype_name)
    #에셋내부에 Task 생성
    #중복 될경우 에러 발생
```
- bulk_create
```python
wh2api.asset_task.bulk_create(project_idx,asset_idx=[],tasktype_name=[])
#asset_idx와 tasktype_name을 똑같은 수를 배열로 보내야함
#ex)
tasktype = ['concept','modeling','texture','lodev','concept','modeling','texture','lodev']
#인덱스가 1,2번인 에셋에  'concept','modeling','texture','lodev' 4개의 테스크를 각각 등록

```
- status_change
```python
wh2api.asset_task.status_change(project_idx,task_idx,status_idx)
    #특정 Task의 Task Staus를 변경
```

- start
```python
wh2api.asset_task.start(project_idx,task_idx)
    #Task Start(MyTask>Todo)
```

- stop
```python
wh2api.asset_task.stop(project_idx,task_idx)
    #Task Stop(MyTask>Todo)
```

## 13. version
- key
```python
wh2api.version.key(task_idx, which='shot or asset')
    #특정 Task의 Key를 얻어내는 함수
    #Version_key생성
```

- key_read
```python
wh2api.version.key_read(version_key)
    #Version_key 정보 조회
```

- create
```python
wh2api.version.create(task_idx='', 
                      which='shot or asset',
                      version_name='',
                      task_status_idx='',
                      version_status_idx='',
                      reviewer_user_idx='',
                      hour_spent='',
                      version_path=[],
                      metadata= [],
                      description="",
                      cc_user_idx='',
                      thumbnail_path = ""):


    # 윈도우의경우 version Path입력시 'r'을 입력
    #ex) version_path = r'c:\\c2monster\test.mov'
    # 지원 *.mp4
    # 서버에서 컨버팅 하는 과정이 없기때문에 업로드하는 버전의 용량이 클 경우 플레이가 안될 수 있음


    #참조 인원 cc_user_idx=[1,2,3]

    # #version_path와 metadata의 리스트의 개수와 순서는 같아야 합니다.
        # version_path = ['a','b','c'] 
        # metadata = ['a_meta','b_meta','c_meta']

```

## 14. user
- list
```python
wh2api.user.list()
    #웜홀에 가입되있는 유저 조회
```
## 15. team
- list
```python
wh2api.team.list()
    #Team의 목록 조회
```

- user_list
```python
wh2api.team.user_list(team_idx)
    #선택한 Team안에 있는 User조회
```
## 16. mytask
- todo
```python
wh2api.mytask.todo(observed_user_idx="")
    #observed_user_idx가 공백인경우 본인
    #observed_user_idx에 User_idx를 추가할 경우 해당 인원의 MyTask조회
```

- inprogress
```python
wh2api.mytask.inprogress(last="")
    #last입력시 마지막 버전만 조회
```

- done
```python
wh2api.mytask.done()
    #끝난Task조회
```

- cc
```python
wh2api.mytask.cc(last="")
    #last입력시 마지막 버전만 조회

```

## 17. org
- read
```python
wh2api.org.read(org_id='std')
    #std가 기본값임
    #System information 정보 조회 가능
```



## 18. publish
- key
```python
wh2api.publish.key(task_idx, which='shot or asset')
#which는 'shot' 또는 'asset'이라고 입력 합니다.
```
- key_read
```python
wh2api.publish.key_read(publish_key)
#퍼블리시키의 상세정보 조회
#퍼블리시 생성시 사용

```
- create
```python
wh2api.publish.create(task_idx='',
           which='shot or asset',
           version_idx='',
           publish_name ='',
           task_status_idx='',
           version_status_idx='',
           publish_path=[],
           description='',
           tag=''):
#필수 입력값 : Task_idx,which,version_idx,Task_Status_idx,Version_status_idx,Publish_path
#publish_Path는 유효성 겁사를 진행, 해당경로에 파일이나 폴더가 없다면 리스트에서 제외한 후 진행합니다.
# publish_path의 유효성 검사 중, 한개의 파일 또는 폴더가 없다면 프로세스는 종료 됩니다.
```


## 19. Track
Wormhole의 Track페이지에 나오는 항목을 조회

- version
```python
wh2api.track.version(projectidx=int
                     from_date="yy-mm-dd",
                     to_date="yy-mm-dd",
                     last=""                     
)
    '''
    :param project_idx:프로젝트 index
    :param from_date: 시작일정
    :param to_date: 종료일정
    :param last: 마지막 버전만 확인하고 싶을땐 "last"입력
    :return:
    '''

```

- shot_task
```python
wh2api.track.shot_task(project_idx,episode_idx,sequence_idx="all",page=1)
    '''
    :param project_idx:프로젝트 인덱스
    :param episode_idx: 에피소드 인덱스
    :param sequence_idx: 필요시 인덱스 입력
    :param page: 기본값 1페이지 
    {'next_data': False, 'page': 2 }으로 다음페이지여부가 표시됨
    :return:
    '''
```

- asset_task

```python
wh2api.track.asset_task(project_idx,category_idx='all',page=1)
    '''
    :param project_idx: 프로젝트 인덱스
    :param category_idx: 필요시 카테고리 인덱스 입력
    :param page: 기본값1페이지
        {'next_data': False, 'page': 2 }으로 다음페이지여부가 표시됨
    :return:
    '''

```


---
## c2monster 
c2monster는 영화 드라마 제작을 위한 소프트웨어를 개발하는 회사 입니다.
### wormhole

http://wormholepipeline.com


E-mail : wfjo852@c2monster.com , contact@c2monster.com


