Notices


Reply
Thread Tools
blubbi's Avatar
Posts: 288 | Thanked: 113 times | Joined on Dec 2009 @ Germany
#171
I know it is not woking and as soon as I have some time to spare I will investigate.

Currently my head is up in paperwork, publications and talks... sorry guys, but it is not gonna happen this week.

Installing old versions does not help, since something on the website must have changed (rough guess, since I didn't change the o2online.de class)

Sorry again.

Cheers
Bjoern
 
Posts: 729 | Thanked: 155 times | Joined on Dec 2009
#172
But why is Web2SMS still working without an update?
 
Posts: 11 | Thanked: 12 times | Joined on Sep 2007
#173
Originally Posted by DaSilva View Post
But why is Web2SMS still working without an update?
Probably because they're different projects, written by different people, in different languages (predominantly C/C++ versus python), with different setups and configuration.

Your question is like asking why Firefox does something when Internet Explorer doesn't - they're not the same program, they're written by different people, they're not doing things in the same way - and it's quite frequent that a website change can work perfectly in one browser but break horribly in another.

The new www2sms is working fine with the Exetel provider, so I'd say the issue is specific to the O2online.de provider. It's entirely possible that their website has changed in a way that affects one and not the other...that said, there's also been a Python QT update for the phone in the last week that may also have affected www2sms (and probably not affected the O2 provider implementation in web2sms since they don't use python for the majority of the program).

Honestly, if you prefer web2sms, use it. Having the 2 programs gives choice. For me, the Exetel provider in web2sms is broken, and the string of spagetti code to thread to fix it is a nightmare I really couldn't face - plus fixing some of the Exetel provider issues in web2sms means breaking other sms providers *wrinkles nose* which is not something I really wanted to do. Implementing the Exetel provider in www2sms was a better choice for me - and I got significantly more functionality for the provider by doing so than the web2sms implementation enabled.

Last edited by Dawnmist; 2010-09-07 at 13:51.
 
blubbi's Avatar
Posts: 288 | Thanked: 113 times | Joined on Dec 2009 @ Germany
#174
o2online.de is fixed in www2sms-1.1.2

(just submitted to the autobuilder queue)

Cheers
Bjoern
 

The Following User Says Thank You to blubbi For This Useful Post:
NightShift79's Avatar
Posts: 417 | Thanked: 200 times | Joined on Apr 2010 @ Germany
#175
thank you!
 
ejasmudar's Avatar
Posts: 800 | Thanked: 957 times | Joined on Sep 2010 @ India
#176
I tried making a new class for th indian web-to-sms site 160by2.com. I tried to add it to the source and run it from xterm with the command
Code:
run-standalne.sh python2.5 www2sms.py
. But apparently, things are not as simple as that.

So, 1. How do i compile a package from source?
2. i will post the new class here, can you please check if it works?

Code:
class provider_160by2(provider):
	def getName(self):
		return '160by2'
	def hasAdvancedFeatures(self):
		return False
	def chars_per_sms(self):
		return 80, 80
	def num_regexp(self, num):
	    	# Get rid of everything except 
		#num = re.sub(r'[^(0-9)|\+]', '', num)
		num = re.sub(r'[^(0-9)]', '', num)
		# handle a couple of number formats (only mobile numbers allowed)
		#if re.search(r'^\+316\d{8}$', num):	# ITU format, +31 is the Netherlands
		if re.search(r'^91\d{10}$', num):	# 91 is India
			num = number[2:]
			return True, num, 'Valid Number-India'
		elif re.search(r'^965\d{8}$', num):	# local dialing format
			num = number[:]
			return True, num, 'Valid Number-Kuwait'
		else:
			return False, num, 'Only India/Kuwait mobile phone numbers allowed'

	def sendSMS(self, MainWindow, app, NUMBER, SMSTEXT, LOGIN, PASSWORD):
		# TODO: check whether sending worked
		# TODO: handle "2 per day maximum"
		# TODO: localization support (at least English and Dutch)

                # XXX: GUI manipulation
                MainWindow.Stat.show()
		MainWindow.Stat.ui.progressBar.setMinimum(0)
		MainWindow.Stat.ui.progressBar.setMaximum(8)

		# set up our browser
		UpdatePbar(self, MainWindow, app, "1", "Initiating the browser")
		br = mechanize.Browser()
		cj = cookielib.LWPCookieJar()
		br.set_cookiejar(cj)

		# login
		try:
			UpdatePbar(self, MainWindow, app, "2", "Connecting to login page")
			br.open('http://www.160by2.com')
			UpdatePbar(self, MainWindow, app, "3", "Logging in")
			br.select_form(id='login_form')
			br.form['htxt_UserName'] = LOGIN
			br.form['txt_Passwd'] = PASSWORD
			br.submit()
		except:
			return False, "Error logging in"


		# verify our login worked and return error if not
	   	UpdatePbar(self, MainWindow, app, "4", "Checking login")
		br.response().read()
		try:
			br.find_link(text='Logout')
		except mechanize.LinkNotFoundError:
			return False, 'Login failed'

		# send the SMS
   	        UpdatePbar(self, MainWindow, app, "5", "Opening SMS page")
		try:
			#br.open('https://my.vodafone.nl/Prive/My_Vodafone/gratis_sms_versturen')
			br.open('http://160by2.com/compose_sms.aspx')
		except:
			return False, 'Error opening free SMS web page'
   	        UpdatePbar(self, MainWindow, app, "6", "Checking maximum SMS per day")
	
   	        UpdatePbar(self, MainWindow, app, "7", "Sending SMS")
		try:
			br.select_form(name='frmcompose')
			br.form['useremails'] = number
			br.form['txt_msg'] = SMSTEXT
			br.submit()
		except:
			print response
			return False, 'Error submitting SMS form'

		# check to see if our send worked
   	        UpdatePbar(self, MainWindow, app, "8", "Confirming SMS sent")
		response = br.response().read()
		if re.search(r'Message Sent to following Numbers', response):
			return True, "Provider responded: Message Sent."
		#elif re.search(r'Je hebt het maximum aantal gratis SMS\'jes voor vandaag verstuurd.', response):
		#	return False, "Provider responded: Je hebt het maximum aantal gratis SMS'jes voor vandaag verstuurd."
		else:
			return False, 'Message not sent'
        	MainWindow.Stat.close()
 
blubbi's Avatar
Posts: 288 | Thanked: 113 times | Joined on Dec 2009 @ Germany
#177
Originally Posted by ejasmudar View Post
I tried making a new class for th indian web-to-sms site 160by2.com. I tried to add it to the source and run it from xterm with the command
Code:
run-standalne.sh python2.5 www2sms.py
. But apparently, things are not as simple as that.


2. i will post the new class here, can you please check if it works?

[CODE]
class provider_160by2(provider):
def getName(self):
return '160by2'
def hasAdvancedFeatures(self):
return False
[...]
A quick lookup on the requested providers website revealed an API for sending SMS:
http://www.smscountry.com/Developers.asp?code=httpjava&sft=1
http://www.smscountry.com/Downloads%5CSMSCountry_HTTP_API.pdf

You should use this API, if applicable, and not scrape the website. If this API does not work, we'll have a look on your previous code.

As template you can use "provider_Telbo"

don't forget to copy
www2sms_gui_widget_advanced_telbo.py and www2sms_gui_widget_advanced_telbo.py
to
www2sms_gui_widget_advanced_${YOUR_PROVIDER_NAME}. py and www2sms_gui_widget_advanced_${YOUR_PROVIDER_NAME}. ui

Originally Posted by ejasmudar View Post
So, 1. How do i compile a package from source?
You do not have to compile anything!
Just run www2sms.py from the commandline
"python www2sms.py"

Cheers
Bjoern
 

The Following User Says Thank You to blubbi For This Useful Post:
ejasmudar's Avatar
Posts: 800 | Thanked: 957 times | Joined on Sep 2010 @ India
#178
Hey, wow that was fast. The API is for 'SMS country' which is kind of like a parent company of 160by2.com. I can't use it as it is mainly a paid service for worldwide sms and bulk sms, while 160by2.com is free (with ad) service.

So, i dont think API can be used, although there is a google desktop widget that is based on a web widget :http://www.cse.iitb.ac.in/~sunnygoya...er/160by2.html

Can it be used in any way?

As for the compiling, i though that i had to make it into .deb before using it. Also, reading through the thread, i understood that the errors faced by me was cleared after ver 1.0, so now I am downloading the lastest version.

Thanks again.
 
blubbi's Avatar
Posts: 288 | Thanked: 113 times | Joined on Dec 2009 @ Germany
#179
I have no clue what "google desktop gadgets" are, but you might have a look at the source code to see how it dispatches SMS to the provider. Maybe there is a API.

You could try to contact the autor of this gadget and ask if he used a API or scraped the website if the src-code is not available.

Yes, be sure to download the lates version before you start to modify anything :-)

Cheers
Bjoern
 
ejasmudar's Avatar
Posts: 800 | Thanked: 957 times | Joined on Sep 2010 @ India
#180
I am still trying with the scraping technique (mostly because i did some work on it already).

My first error was "global name 'number' not defined"
This was in line
Code:
num = number[3:]
I dunno if its right, but nevertheless, i modifies number to num and the error goes away.

Next I am getting error "global name 'cookielib' is not defined".

I have a feeling i'm missing something here and that these two are related. What happened? is some file with global variables missing?

EDIT: OK, i imported cookielib and error went away. Was that a bug? Anyway now i am stuck at login error.

Last edited by ejasmudar; 2010-09-16 at 15:02.
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 22:13.