jaraco / googlevoice

Python Google Voice library based on pygooglevoice
MIT License
112 stars 33 forks source link

Can not send sms "JSONDecodeError: Expecting value: line 3 column 1 (char 2)" #6

Closed slow-quick closed 6 years ago

slow-quick commented 6 years ago

from six.moves import input from googlevoice import Voice

def run(): voice = Voice() voice.login()

phoneNumber = input('Number to send message to: ')
text = input('Message text: ')

voice.send_sms(phoneNumber, text)

run()


login seems fine (no error raised) when prompt, typed in: phoneNume = 1xxxxxxxxxx text = hello from gv

JSONDecodeError Traceback (most recent call last)

in () 12 voice.send_sms(phoneNumber, text) 13 ---> 14 run() in run() 10 text = input('Message text: ') 11 ---> 12 voice.send_sms(phoneNumber, text) 13 14 run() ~\Anaconda3\lib\site-packages\googlevoice\voice.py in send_sms(self, phoneNumber, text) 207 """ 208 self.__validate_special_page( --> 209 'sms', {'phoneNumber': phoneNumber, 'text': text}) 210 211 def search(self, query): ~\Anaconda3\lib\site-packages\googlevoice\voice.py in __validate_special_page(self, page, data, **kwargs) 297 """ 298 data.update(kwargs) --> 299 util.load_and_validate(self.__do_special_page(page, data)) 300 301 _Phone__validate_special_page = __validate_special_page ~\Anaconda3\lib\site-packages\googlevoice\util.py in load_and_validate(response) 19 Loads JSON data from http response then validates 20 """ ---> 21 validate_response(response.json()) 22 23 ~\Anaconda3\lib\site-packages\requests\models.py in json(self, **kwargs) 894 # used. 895 pass --> 896 return complexjson.loads(self.text, **kwargs) 897 898 @property ~\Anaconda3\lib\json\__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 346 parse_int is None and parse_float is None and 347 parse_constant is None and object_pairs_hook is None and not kw): --> 348 return _default_decoder.decode(s) 349 if cls is None: 350 cls = JSONDecoder ~\Anaconda3\lib\json\decoder.py in decode(self, s, _w) 335 336 """ --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() 339 if end != len(s): ~\Anaconda3\lib\json\decoder.py in raw_decode(self, s, idx) 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: --> 355 raise JSONDecodeError("Expecting value", s, err.value) from None 356 return obj, end JSONDecodeError: Expecting value: line 3 column 1 (char 2)
slow-quick commented 6 years ago

My bad. I used a gmail without google voice to test the code. Case closed.