|
1 | 1 | # -*- coding: utf8 -*- |
| 2 | +# vi:set sw=4 ts=4 expandtab: |
2 | 3 | """ |
3 | | - Copyright (C) 2008-2015 NURIGO |
| 4 | + Copyright (C) 2008-2016 NURIGO |
4 | 5 | http://www.coolsms.co.kr |
5 | 6 | """ |
6 | | -import sys,json |
| 7 | +import sys |
| 8 | +import json |
7 | 9 | sys.path.append("..") |
8 | 10 | import coolsms |
9 | 11 |
|
10 | 12 | def main(): |
11 | | - # API Credential 정보 |
12 | | - # https://www.coolsms.co.kr/index.php?mid=service_setup&act=dispSmsconfigCredentials |
13 | | - api_key = 'NCS52A57F48C3D32' |
14 | | - api_secret = '5AC44E03CE8E7212D9D1AD9091FA9966' |
| 13 | + # API Credential 정보 |
| 14 | + # https://www.coolsms.co.kr/index.php?mid=service_setup&act=dispSmsconfigCredentials |
| 15 | + api_key = 'NCS52A57F48C3D32' |
| 16 | + api_secret = '5AC44E03CE8E7212D9D1AD9091FA9966' |
15 | 17 |
|
16 | | - # 수신번호 |
17 | | - to = '01000000000,01011111111' # <--- input comma-separated numbers |
| 18 | + # 수신번호 |
| 19 | + to = '01000000000,01011111111' # <--- input comma-separated numbers |
18 | 20 |
|
19 | | - # 발신번호 |
20 | | - # 2015/10/16 발신번호 등록제 시행에 따라 사전에 등록된 발신번호만 허용 |
21 | | - # http://www.coolsms.co.kr/index.php?mid=service_setup&act=dispSmsconfigSenderNumbers |
22 | | - sender = '01012345678' |
| 21 | + # 발신번호 |
| 22 | + # 2015/10/16 발신번호 등록제 시행에 따라 사전에 등록된 발신번호만 허용 |
| 23 | + # http://www.coolsms.co.kr/index.php?mid=service_setup&act=dispSmsconfigSenderNumbers |
| 24 | + sender = '01012345678' |
23 | 25 |
|
24 | | - # 메시지 내용 |
25 | | - message = '테스트 메시지' |
| 26 | + # 메시지 내용 |
| 27 | + message = '테스트 메시지' |
26 | 28 |
|
27 | | - # JSON형식의 extension 데이터 |
28 | | - # 위에서 정의된 to, sender, message 등 기본 데이터를 상속받아 개별 메시지로 발송된다. |
29 | | - data = [ {"to":"01000000001", "text":"Hello A"}, {"to":"01000000002", "text":"Hello B"} ] |
30 | | - extension = json.dumps(data) |
| 29 | + # JSON형식의 extension 데이터 |
| 30 | + # 위에서 정의된 to, sender, message 등 기본 데이터를 상속받아 개별 메시지로 발송된다. |
| 31 | + data = [ {"to":"01000000001", "text":"Hello A"}, {"to":"01000000002", "text":"Hello B"} ] |
| 32 | + extension = json.dumps(data) |
31 | 33 |
|
32 | | - # API Key, API Secret, App Version |
33 | | - cool = coolsms.rest(api_key, api_secret, 'Example 1.0') |
34 | | - status = cool.send(to,message,sender,extension=extension) |
| 34 | + # API Key, API Secret, App Version |
| 35 | + cool = coolsms.rest(api_key, api_secret, 'Example 1.0') |
| 36 | + status = cool.send(to,message,sender,extension=extension) |
35 | 37 |
|
36 | | - # 리턴값 출력 |
37 | | - print status |
| 38 | + # 리턴값 출력 |
| 39 | + print status |
38 | 40 |
|
39 | | - # 리턴값이 False이면 오류 |
40 | | - if status == False: |
41 | | - print "ERROR: %s" % cool.get_error() |
| 41 | + # 리턴값이 False이면 오류 |
| 42 | + if status == False: |
| 43 | + print "ERROR: %s" % cool.get_error() |
42 | 44 |
|
43 | 45 | if __name__ == "__main__": |
44 | | - main() |
45 | | - sys.exit(0) |
| 46 | + main() |
| 47 | + sys.exit(0) |
0 commit comments