Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have observed error code(<Response [404]>) on these line:58 and 60 when I calling this def: q.msgSentToday() #7

Open
muthukumarece5 opened this issue Jul 15, 2018 · 5 comments

Comments

@muthukumarece5
Copy link

self.t=self.soup.find("div",{"class":"hed"}).h2.text # div element with class "hed" -> h2

Have observed error code(<Response [404]>) on this line:58 => self.q=self.session.get(self.msg_left_url) and got exception on this line:60 self.t=self.soup.find("div",{"class":"hed"}).h2.text
line:58
(<Response [404]>)
line:60
(<class 'AttributeError'>, AttributeError("'NoneType' object has no attribute 'h2'",), <traceback object at 0x0000005524E61208>)

If I comment out q.msgSentToday() it is works fine.

Regards,
Muthu

@muthukumarece5 muthukumarece5 changed the title Have observed error code(<Response [404]>) on this line:58 and 60 when I calling this def: q.msgSentToday() Have observed error code(<Response [404]>) on these line:58 and 60 when I calling this def: q.msgSentToday() Jul 15, 2018
@muthukumarece5
Copy link
Author

@shubhamc183

@shubhamc183
Copy link
Owner

yes, it is still an issue.
Need to find a way to code it.
Please have a look if you can figure it out.

@muthukumarece5
Copy link
Author

Hi @shubhamc183,

I unable to found div, class inside Dev from get session page.I can't seen how much sms have been sent on html parser output. So could please look at issue and fix it.

Regards,
Muthu

@shubhamc183
Copy link
Owner

I'll have a look at this.

@sumanmichael
Copy link

sumanmichael commented Oct 23, 2018

Replace the lines from 57 with this code

self.msg_left_url='http://www.way2sms.com/sent-sms?Token='+self.jsid
self.q=self.session.get(self.msg_left_url)
self.soup=BeautifulSoup(self.q.text,'html.parser')		
self.t=self.soup.find_all("a",{"class":"active"})[1]	# second "a" element with class "active" and sliced
if(self.t.get_text()[-2:-1].isdecimal()):
	self.sent=int(self.t.get_text()[-2:-1])
else:
	self.sent=0
return(self.sent)

This may help you..:-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@shubhamc183 @sumanmichael @muthukumarece5 and others