helallao / perplexity-ai

Unofficial API Wrapper for Perplexity.ai + Account Generator
https://perplexity.ai
MIT License
285 stars 50 forks source link

JSONDecodeError: Expecting value: line 1 column 1 (char 0) #9

Closed damarega closed 1 year ago

damarega commented 1 year ago

Hi, I already followed the steps provided but getting this error JSONDecodeError: Expecting value: line 1 column 1 (char 0) from running this code perplexity_cli = Client(perplexity_headers, perplexity_cookies)

Here is the traceback of the error:

JSONDecodeError Traceback (most recent call last) in <cell line: 1>() ----> 1 perplexity_cli = Client(perplexity_headers, perplexity_cookies) 2 #perplexity_cli.create_account(emailnator_headers, emailnator_cookies) # Creates a new gmail, so your 5 copilots will be renewed. You can pass this one if you are not going to use "copilot" mode 3 4 # modes = ['concise', 'copilot'] 5 # focus = ['internet', 'scholar', 'writing', 'wolfram', 'youtube', 'reddit', 'wikipedia']

3 frames in init(self, headers, cookies) 68 69 self.t = format(random.getrandbits(32), '08x') ---> 70 self.sid = json.loads(self.session.get(f'https://www.perplexity.ai/socket.io/?EIO=4&transport=polling&t={self.t}').text[1:])['sid'] 71 self.frontend_uuid = str(uuid4()) 72 self.frontend_session_id = str(uuid4())

/usr/lib/python3.10/json/init.py in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 344 parse_int is None and parse_float is None and 345 parse_constant is None and object_pairs_hook is None and not kw): --> 346 return _default_decoder.decode(s) 347 if cls is None: 348 cls = JSONDecoder

/usr/lib/python3.10/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):

/usr/lib/python3.10/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

helallao commented 1 year ago

Repository updated. Use the new version.