PYTHON SDK
v2.0.3
메인 페이지
패키지
클래스
파일들
파일 목록
upload_image.py
이 파일의 문서화 페이지로 가기
1
# vi:set sw=4 ts=4 expandtab:
2
# -*- coding: utf8 -*-
3
4
import
sys
5
6
sys.path.insert(0,
"../../"
)
7
8
from
sdk.api.image
import
Image
9
from
sdk.exceptions
import
CoolsmsException
10
11
## @brief This sample code demonstrate how to upload image through CoolSMS Rest API
12
if
__name__ ==
"__main__"
:
13
14
# set api key, api secret
15
api_key =
"#ENTER_YOUR_OWN#"
16
api_secret =
"#ENTER_YOUR_OWN#"
17
18
# image is must be entered
19
image =
"test.jpg"
# image file
20
cool =
Image
(api_key, api_secret)
21
22
try
:
23
response = cool.upload_image(image)
24
print(
"Image ID : %s"
% response[
'image_id'
])
25
26
except
CoolsmsException
as
e:
27
print(
"Error Code : %s"
% e.code)
28
print(
"Error Message : %s"
% e.msg)
29
30
sys.exit()
sdk.api.image
Definition:
image.py:1
sdk.exceptions
Definition:
exceptions.py:1
sdk.api.image.Image
management image, using Rest API
Definition:
image.py:16
C:
Users
Administrator
hosy
배포
python-sdk-2.0.3
python-sdk-2.0.3
examples
image
upload_image.py
다음에 의해 생성됨 :
1.8.11