Commits

Denis Khabarov committed 75d862a

modified: smssend.py
Исправлены мелкие ошибки в опциях --from, --time

  • Participants
  • Parent commits a7034ee

Comments (0)

Files changed (1)

 from urllib2 import urlopen, URLError
 from urllib import quote
 from os import getenv
-
 __author__ = "Denis 'Saymon21' Khabarov"
 __copyright__ = "Copyright © 2012 Denis 'Saymon21' Khabarov"
 __credits__ = []
 
 def get_home_path():
 	if sys.platform.startswith('freebsd') or sys.platform.startswith('linux'):
-		return getenv('HOME')
+		home=getenv('HOME')
 	elif sys.platform.startswith('win'):
-		return getenv('USERPROFILE')
-					
-def get_api_id():
-	api_id=None
-	myhomepath=get_home_path()
-	if myhomepath is None:
+		home=getenv('USERPROFILE')
+	if home is None:
 		print("Unable to get home path.")
 		sys.exit(3)
+	else:
+		return home
+			
+def get_api_id():
 	if cliargs.api_id is None:
 		try:
-			fp=open("%s/.smssendrc" % (myhomepath))
+			fp=open("%s/.smssendrc" % (get_home_path()))
 		except IOError as errstr:
 			print(errstr)
 			sys.exit(3)
 	if cliargs.debug==True:
 		url="%s&test=1" % (url)
 	elif cliargs.sendername is not None:
-		url="&from=%s" % (url, cliargs.sendername)
+		url="%s&from=%s" % (url, cliargs.sendername)
 	elif cliargs.time is not None:
-		url="&time=%d" % (url, int(cliargs.time))
+		url="%s&time=%d" % (url, int(cliargs.time))
 	
 	try:
 		res=urlopen(url,timeout=cliargs.http_timeout)