I am trying to send a message to phone using python via way2sms

625 Views Asked by At
import way2sms
import requests

q=way2sms.sms('Arjun','xyz')
q.send(9418403783,'Yo their I am arjun')
n=q.msgSentToday()
q.logout()

And I am getting the following error when I run the command. , I have all the required modules installed but facing an error.

Traceback (most recent call last): File "C:/Users/my dell/AppData/Local/Programs/Python/Python36- 32/records/smssend.py", line 4, in q=way2sms.sms('Arjun','M9329G') File "C:\Users\my dell\AppData\Local\Programs\Python\Python36- 32\lib\way2sms.py", line 17, in init self.s=requests.Session() # Session because we want to maintain the cookies AttributeError: module 'requests' has no attribute 'Session'

2

There are 2 best solutions below

0
On

You can use the official API of way2sms from their website. It is a 100% working solution for free test keys. For details, see my answer at- Sending SMS using Python via way2sms

0
On

Sending SMS work properly .Try this .

import requests
import json

URL = 'http://www.way2sms.com/api/v1/sendCampaign'
def sendPostRequest(reqUrl):
  req_params = {
  'apikey':'key',
  'secret':'secret',
  'usetype':'stage',
  'phone': 'phone',
  'message':'Hello ',
  }