#!/usr/bin/env python
# coding=utf-8

# python3 /home/scripts_python_tests_capteurs/FREE_SMS/test_SMS.py
#----------------------------------------------------------------------
# https://smsapi.free-mobile.fr/sendmsg?user=94677089&pass=xq23tDdkmnOJfy&msg=Hello%20World%20!


import requests
import sys

'''
user = '94677089'

# pass : FreeMobile TP4
api_key = 'xq23tDdkmnOJfy'

msg = "test_koko"

f = { 'user' : user, 'pass' : api_key, 'msg' : msg }
url = "https://smsapi.free-mobile.fr/sendmsg?"
# on encode le tout et on crée l'url d'envoi
goto = url + urllib3.urlencode(f)
# on envoie
urllib3.urlopen(goto)
'''


#----------------------------------------------------------------------
message = "test_koko"


url_string  = 'https://smsapi.free-mobile.fr/sendmsg?user=94677089&pass=xq23tDdkmnOJfy&msg=' + message
response = requests.get( url_string )
print(response)

if ( '<Response [200]>' in str(response) ) :
	texte_email = "OK"
	
else :
	texte_email = "NOK"
	
print(texte_email)

	
