$pip install coolsms_python_sdk
pip를 이용하여 설치하기.
conda에는 아쉽게도 지원하지 않는 듯 합니다.
이렇게 cmd창에서 설치한 후
https://console.coolsms.co.kr/
회원가입 후 api_key를 발급하시면 됩니다!! 회원가입 하는 과정에
발급을 받을 수 있어요~
import sys from sdk.api.message import Message from sdk.exceptions import CoolsmsException ## @brief This sample code demonstrate how to send sms through CoolSMS Rest API PHP if __name__ == "__main__": # set api key, api secret api_key = "본인api_key입력" api_secret = "본인api_secret입력" ## 4 params(to, from, type, text) are mandatory. must be filled params = dict() params['type'] = 'sms' # Message type ( sms, lms, mms, ata ) params['to'] = '010000000' # Recipients Number '01000000000,01000000001' params['from'] = '01000000000' # Sender number params['text'] = 'python문자 가는지 테스트하기' # Message cool = Message(api_key, api_secret) try: response = cool.send(params) print("Success Count : %s" % response['success_count']) print("Error Count : %s" % response['error_count']) print("Group ID : %s" % response['group_id']) if "error_list" in response: print("Error List : %s" % response['error_list']) except CoolsmsException as e: print("Error Code : %s" % e.code) print("Error Message : %s" % e.msg) sys.exit()
이렇게 코드를 작성하면 됩니다~
그러면 이렇게 잘 가지는 것을 볼 수 있습니다~
사용 후 느낀 점
- 사용하기 매우 쉬운 듯 합니다.
- 별다른 코드를 건드리지 않고 api_key와 secret, 그 외 몇몇개만 건드린다면 매우 편하게 사용 가능
- 회원가입 하는것이 code 짜는 것보다 더 힘들게 느껴질 정도
2. 문자 한 건당 20p.
- 첫 회원 가입 시 300p를 줌.
- 하루 50건 발송 가능하다.(이 부분은 별도의 조취를 취할 시 변할지는 모름)
- 국내 api라 무자 앞에 [국제발송]이라는 메시지가 포함되지 않음.
Uploaded by Notion2Tistory v1.1.0