Skip to content
This repository was archived by the owner on Feb 28, 2025. It is now read-only.

Commit f830435

Browse files
committed
Merge pull request #3 from wileyday/master
Code description added.
2 parents 6d9cc6b + 1e673e8 commit f830435

8 files changed

Lines changed: 130 additions & 5 deletions

File tree

examples/send_extensions.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,35 @@
88
import coolsms
99

1010
def main():
11+
# API Credential 정보
12+
# https://www.coolsms.co.kr/index.php?mid=service_setup&act=dispSmsconfigCredentials
1113
api_key = 'NCS52A57F48C3D32'
1214
api_secret = '5AC44E03CE8E7212D9D1AD9091FA9966'
15+
16+
# 수신번호
1317
to = '01000000000,01011111111' # <--- input comma-separated numbers
18+
19+
# 발신번호
20+
# 2015/10/16 발신번호 등록제 시행에 따라 사전에 등록된 발신번호만 허용
21+
# http://www.coolsms.co.kr/index.php?mid=service_setup&act=dispSmsconfigSenderNumbers
1422
sender = '01012345678'
23+
24+
# 메시지 내용
1525
message = '테스트 메시지'
26+
27+
# JSON형식의 extension 데이터
28+
# 위에서 정의된 to, sender, message 등 기본 데이터를 상속받아 개별 메시지로 발송된다.
1629
data = [ {"to":"01000000001", "text":"Hello A"}, {"to":"01000000002", "text":"Hello B"} ]
1730
extension = json.dumps(data)
31+
32+
# API Key, API Secret, App Version
1833
cool = coolsms.rest(api_key, api_secret, 'Example 1.0')
1934
status = cool.send(to,message,sender,extension=extension)
35+
36+
# 리턴값 출력
2037
print status
38+
39+
# 리턴값이 False이면 오류
2140
if status == False:
2241
print "ERROR: %s" % cool.get_error()
2342

examples/send_lms.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,34 @@
88
import coolsms
99

1010
def main():
11+
# API Credential 정보
12+
# https://www.coolsms.co.kr/index.php?mid=service_setup&act=dispSmsconfigCredentials
1113
api_key = 'NCS52A57F48C3D32'
1214
api_secret = '5AC44E03CE8E7212D9D1AD9091FA9966'
15+
16+
# 수신번호
1317
to = '01000000000'
18+
19+
# 발신번호
20+
# 2015/10/16 발신번호 등록제 시행에 따라 사전에 등록된 발신번호만 허용
21+
# http://www.coolsms.co.kr/index.php?mid=service_setup&act=dispSmsconfigSenderNumbers
1422
sender = '01012345678'
23+
24+
# 메시지 내용
1525
message = 'LMS 2,000 바이트까지 입력가능합니다'
26+
27+
# API Key, API Secret, App Version
1628
cool = coolsms.rest(api_key, api_secret, 'Example 1.0')
29+
30+
# 메시지 발송 요청
1731
status = cool.send(to,message,sender,mtype='lms',subject='LMS 제목(40바이트)')
32+
33+
# 리턴값 출력
34+
print status
35+
36+
# 리턴값이 False이면 오류
1837
if status == False:
1938
print cool.get_error()
20-
print status
2139

2240
if __name__ == "__main__":
2341
main()

examples/send_mms.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,34 @@
88
import coolsms
99

1010
def main():
11+
# API Credential 정보
12+
# https://www.coolsms.co.kr/index.php?mid=service_setup&act=dispSmsconfigCredentials
1113
api_key = 'NCS52A57F48C3D32'
1214
api_secret = '5AC44E03CE8E7212D9D1AD9091FA9966'
15+
16+
# 수신번호
1317
to = '01000000000'
18+
19+
# 발신번호
20+
# 2015/10/16 발신번호 등록제 시행에 따라 사전에 등록된 발신번호만 허용
21+
# http://www.coolsms.co.kr/index.php?mid=service_setup&act=dispSmsconfigSenderNumbers
1422
sender = '01012345678'
23+
24+
# 메시지 내용
1525
message = 'MMS 2,000 바이트까지 입력가능합니다'
26+
27+
# API Key, API Secret, App Version
1628
cool = coolsms.rest(api_key, api_secret, 'Example 1.0')
29+
30+
# 메시지 발송 요청
1731
status = cool.send(to,message,sender,mtype='mms',subject='MMS 제목(40바이트)',image='test.jpg')
32+
33+
# 리턴값 출력
34+
print status
35+
36+
# 리턴값이 False이면 오류
1837
if status == False:
1938
print cool.get_error()
20-
print status
2139

2240
if __name__ == "__main__":
2341
main()

examples/send_oversea_sms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def main():
1414
sender = '01012345678'
1515
message = '테스트 메시지'
1616
cool = coolsms.rest(api_key, api_secret, 'Example 1.0')
17-
status = cool.send(to,message,sender,country='81')
17+
status = cool.send(to,message,sender,country='81') # <---- 국가번호 입력
1818
print status
1919
if status == False:
2020
print "ERROR: %s" % cool.get_error()

examples/send_sms.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,32 @@
88
import coolsms
99

1010
def main():
11+
# API Credential 정보
12+
# https://www.coolsms.co.kr/index.php?mid=service_setup&act=dispSmsconfigCredentials
1113
api_key = 'NCS52A57F48C3D32'
1214
api_secret = '5AC44E03CE8E7212D9D1AD9091FA9966'
15+
16+
# 수신번호
1317
to = '01000000000'
14-
sender = '01012345678'
18+
19+
# 발신번호
20+
# 2015/10/16 발신번호 등록제 시행에 따라 사전에 등록된 발신번호만 허용
21+
# http://www.coolsms.co.kr/index.php?mid=service_setup&act=dispSmsconfigSenderNumbers
22+
sender = '01012345678'
23+
24+
# 메시지 내용
1525
message = '테스트 메시지'
26+
27+
# API Key, API Secret, App Version
1628
cool = coolsms.rest(api_key, api_secret, 'Example 1.0')
29+
30+
# 메시지 발송 요청
1731
status = cool.send(to,message,sender)
32+
33+
# 리턴값 출력
1834
print status
35+
36+
# 리턴값이 False이면 오류
1937
if status == False:
2038
print "ERROR: %s" % cool.get_error()
2139

examples/send_sms_reservation.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,35 @@
88
import coolsms
99

1010
def main():
11+
# API Credential 정보
12+
# https://www.coolsms.co.kr/index.php?mid=service_setup&act=dispSmsconfigCredentials
1113
api_key = 'NCS52A57F48C3D32'
1214
api_secret = '5AC44E03CE8E7212D9D1AD9091FA9966'
15+
16+
# 수신번호
1317
to = '01000000000'
18+
19+
# 발신번호
20+
# 2015/10/16 발신번호 등록제 시행에 따라 사전에 등록된 발신번호만 허용
21+
# http://www.coolsms.co.kr/index.php?mid=service_setup&act=dispSmsconfigSenderNumbers
1422
sender = '01012345678'
23+
24+
# 메시지 내용
1525
message = '테스트 메시지'
26+
27+
# API Key, API Secret, App Version
1628
cool = coolsms.rest(api_key, api_secret, 'Example 1.0')
29+
30+
# 메시지 발송 요청
1731
status = cool.send(to,message,sender,datetime='20140213140000')
32+
33+
# 리턴값 출력
1834
print status
35+
36+
# 리턴값이 False이면 오류
1937
if status == False:
2038
print "ERROR: %s" % cool.get_error()
2139

22-
2340
if __name__ == "__main__":
2441
main()
2542
sys.exit(0)

examples/send_sms_srk.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,32 @@
88
import coolsms
99

1010
def main():
11+
# API Credential 정보
12+
# https://www.coolsms.co.kr/index.php?mid=service_setup&act=dispSmsconfigCredentials
1113
api_key = 'NCS52A57F48C3D32'
1214
api_secret = '5AC44E03CE8E7212D9D1AD9091FA9966'
15+
16+
# 수신번호
1317
to = '01000000000'
18+
19+
# 발신번호
20+
# 2015/10/16 발신번호 등록제 시행에 따라 사전에 등록된 발신번호만 허용
21+
# http://www.coolsms.co.kr/index.php?mid=service_setup&act=dispSmsconfigSenderNumbers
1422
sender = '01012345678'
23+
24+
# 메시지 내용
1525
message = '테스트 메시지'
26+
27+
# API Key, API Secret, App Version, SRK(Solution Registration Key)
1628
cool = coolsms.rest(api_key, api_secret, 'Example 1.0', srk='K0000242263')
29+
30+
# 메시지 발송 요청
1731
status = cool.send(to,message,sender)
32+
33+
# 리턴값 출력
1834
print status
35+
36+
# 리턴값이 False이면 오류
1937
if status == False:
2038
print "ERROR: %s" % cool.get_error()
2139

examples/send_two_sms.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,32 @@
88
import coolsms
99

1010
def main():
11+
# API Credential 정보
12+
# https://www.coolsms.co.kr/index.php?mid=service_setup&act=dispSmsconfigCredentials
1113
api_key = 'NCS52A57F48C3D32'
1214
api_secret = '5AC44E03CE8E7212D9D1AD9091FA9966'
15+
16+
# 수신번호
1317
to = '01000000000,01011111111' # <--- input comma-separated numbers
18+
19+
# 발신번호
20+
# 2015/10/16 발신번호 등록제 시행에 따라 사전에 등록된 발신번호만 허용
21+
# http://www.coolsms.co.kr/index.php?mid=service_setup&act=dispSmsconfigSenderNumbers
1422
sender = '01012345678'
23+
24+
# 메시지 내용
1525
message = '테스트 메시지'
26+
27+
# API Key, API Secret, App Version
1628
cool = coolsms.rest(api_key, api_secret, 'Example 1.0')
29+
30+
# 메시지 발송 요청
1731
status = cool.send(to,message,sender)
32+
33+
# 리턴값 출력
1834
print status
1935

36+
# 리턴값이 False이면 오류
2037
if status == False:
2138
print "ERROR: %s" % cool.get_error()
2239

0 commit comments

Comments
 (0)