prsaw icon indicating copy to clipboard operation
prsaw copied to clipboard

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 

Open TopPoint10 opened this issue 4 years ago • 0 comments

code:

from prsaw import RandomStuff


api_key = api_key
rs = RandomStuff(api_key = api_key)

response =  rs.get_ai_response("How are you?")
print(response)

rs.close()```

error:------------------------------------------------
```py
Ignoring exception in on_message
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "main.py", line 41, in on_message
    response = await client.get_ai_response(msg.content)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/randomstuff/client.py", line 554, in get_ai_response
    _check_status(response)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/randomstuff/_helper.py", line 33, in _check_status
    raise PlanNotAllowed(response.text)
randomstuff.errors.PlanNotAllowed: <bound method ClientResponse.text of <ClientResponse(https://api.pgamerx.com/v5//ai?message=how+are+you&server=main&uid=zcjZxFd4Z3C5UC4erGm6F77l2NmMBK&bot_name=Random+Stuff+API&bot_master=PGamerX&bot_gender=Male&bot_age=19&bot_company=PGamerX+Studio&bot_location=India&[email protected]&bot_build=Public&bot_birth_year=2002&bot_birth
Traceback (most recent call last):
  File "main.py", line 50, in <module>
    loop.run_until_complete(start())
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
Traceback (most recent call last):
  File "main.py", line 125, in <module>
    response =  rs.get_ai_response("How are you?")
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/apiclient/core.py", line 95, in __call__
Traceback (most recent call last):
  File "main.py", line 125, in <module>
    response =  rs.get_ai_response("How are you?")
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/apiclient/core.py", line 95, in __call__
    return self.sync_call(httpx_request)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/apiclient/core.py", line 100, in sync_call
    response = post_processor(response)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/prsaw/PRSAW.py", line 25, in <lambda>
    self._post_processors.append(lambda res: res.json()) File "/opt/virtualenvs/python3/lib/python3.8/site-packages/httpx/_models.py", line 1116, in json
    return jsonlib.loads(self.text, **kwargs)
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
 ```

TopPoint10 avatar Aug 25 '21 12:08 TopPoint10