vrchatapi / VRChatPython

A Python library for the VRChat API.
41 stars 10 forks source link

Can't run the login examples #27

Closed royalroadprog closed 3 years ago

royalroadprog commented 3 years ago

Hello, for weeks I tried adjusting my app to the latest updates but it had always failed on the login process. So I tried running the login examples but they were also both met with errors. I apologize in advance if I missed anything basic or obvious, but I just can't seem to figure it out.

Login.py:

WARNING:root:VRC API Key has not been fetched, fetching
WS connected!
Traceback (most recent call last):
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\request.py", line 55, in call
    path, method, headers, params, jdict, no_auth, verify)
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\request.py", line 125, in _call
    "data": json if json is not None else content})
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\request.py", line 179, in raise_for_status
    switch[resp["response"].status]()
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\request.py", line 172, in <lambda>
    401: lambda: handle_401(),
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\request.py", line 159, in handle_401
    raise ClientErrors.MissingCredentials("Missing Credentials")
vrcpy.errors.MissingCredentials: Missing Credentials

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test10.py", line 25, in <module>
    password="redacted"
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\client.py", line 535, in run
    token
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\asyncio\base_events.py", line 573, in run_until_complete
    return future.result()
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\client.py", line 550, in _run
    await self.start()
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\client.py", line 562, in start
    await self._pre_loop()
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\client.py", line 83, in _pre_loop
    await self.me.fetch_all_favorites()
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\user.py", line 443, in fetch_all_favorites
    self.fetch_favorites, favorite_type=favorite_type)
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\util.py", line 19, in auto_page_coro
    response = await coro(*args, **kwargs)
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\user.py", line 426, in fetch_favorites
    favorites = await self.client.request.call("/favorites", params=params)
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\request.py", line 59, in call
    raise e.__class__(str(e))
vrcpy.errors.MissingCredentials: Missing Credentials
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x03F71530>
ERROR:asyncio:Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x042FB4C8>, 102370.406)]']
connector: <aiohttp.connector.TCPConnector object at 0x0431BFF0>

ManualLogin.py:

WARNING:root:VRC API Key has not been fetched, fetching
WS connected!
Traceback (most recent call last):
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\request.py", line 55, in call
    path, method, headers, params, jdict, no_auth, verify)
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\request.py", line 125, in _call
    "data": json if json is not None else content})
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\request.py", line 179, in raise_for_status
    switch[resp["response"].status]()
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\request.py", line 172, in <lambda>
    401: lambda: handle_401(),
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\request.py", line 159, in handle_401
    raise ClientErrors.MissingCredentials("Missing Credentials")
vrcpy.errors.MissingCredentials: Missing Credentials

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test10.py", line 38, in <module>
    loop.run_until_complete(main())
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\asyncio\base_events.py", line 573, in run_until_complete
    return future.result()
  File "test10.py", line 18, in main
    await client.start()
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\client.py", line 562, in start
    await self._pre_loop()
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\client.py", line 83, in _pre_loop
    await self.me.fetch_all_favorites()
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\user.py", line 443, in fetch_all_favorites
    self.fetch_favorites, favorite_type=favorite_type)
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\util.py", line 19, in auto_page_coro
    response = await coro(*args, **kwargs)
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\user.py", line 426, in fetch_favorites
    favorites = await self.client.request.call("/favorites", params=params)
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\request.py", line 59, in call
    raise e.__class__(str(e))
vrcpy.errors.MissingCredentials: Missing Credentials
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x03F695B0>
ERROR:asyncio:Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x042BA4C8>, 102498.312)]']
connector: <aiohttp.connector.TCPConnector object at 0x03F696D0>
CaptainDestructo commented 3 years ago

Have you double checked that you are using the correct username and password? Also, do you have 2 Factor Authentication set up and using the correct key? ManualLogin.py uses login2fa(). If you aren't using 2FA, you can just use login() in its place, without specifying mfa=123455.

iryis commented 3 years ago

+1 Trying the login examples give a similar error:

Login:

Traceback (most recent call last):
  File "example.py", line 23, in <module>
    client.run(
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\client.py", line 530, in run
    self.loop.run_until_complete(self._run(
  File "C:\Users\nope\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete
    return future.result()
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\client.py", line 550, in _run
    await self.start()
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\client.py", line 562, in start
    await self._pre_loop()
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\client.py", line 78, in _pre_loop
    del self.request.session._default_headers["Authorization"]
KeyError: 'Authorization'
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000001D992E60B80>
ERROR:asyncio:Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x000001D992E6A700>, 10480.687)]']
connector: <aiohttp.connector.TCPConnector object at 0x000001D992E60A60>

ManualLogin: [see above] @CaptainDestructo Trying with and without 2fa = same error

Eventless.py does seem to work unchanged

royalroadprog commented 3 years ago

Apparently I inputted a wrong password before and I tried the correct password but it still gives me error. I have edited the error messages on my original post.

Katistic commented 3 years ago

+1 Trying the login examples give a similar error:

Login:

Traceback (most recent call last):
  File "example.py", line 23, in <module>
    client.run(
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\client.py", line 530, in run
    self.loop.run_until_complete(self._run(
  File "C:\Users\nope\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete
    return future.result()
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\client.py", line 550, in _run
    await self.start()
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\client.py", line 562, in start
    await self._pre_loop()
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\client.py", line 78, in _pre_loop
    del self.request.session._default_headers["Authorization"]
KeyError: 'Authorization'
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000001D992E60B80>
ERROR:asyncio:Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x000001D992E6A700>, 10480.687)]']
connector: <aiohttp.connector.TCPConnector object at 0x000001D992E60A60>

ManualLogin: [see above] @CaptainDestructo Trying with and without 2fa = same error

Eventless.py does seem to work unchanged

7b267ba should prevent this from happening anymore, wait for next pypi push or use the repo dev version

Katistic commented 3 years ago

Hello, for weeks I tried adjusting my app to the latest updates but it had always failed on the login process. So I tried running the login examples but they were also both met with errors. I apologize in advance if I missed anything basic or obvious, but I just can't seem to figure it out.

Login.py:

WARNING:root:VRC API Key has not been fetched, fetching
WS connected!
Traceback (most recent call last):
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\request.py", line 55, in call
    path, method, headers, params, jdict, no_auth, verify)
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\request.py", line 125, in _call
    "data": json if json is not None else content})
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\request.py", line 179, in raise_for_status
    switch[resp["response"].status]()
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\request.py", line 172, in <lambda>
    401: lambda: handle_401(),
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\request.py", line 159, in handle_401
    raise ClientErrors.MissingCredentials("Missing Credentials")
vrcpy.errors.MissingCredentials: Missing Credentials

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test10.py", line 25, in <module>
    password="redacted"
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\client.py", line 535, in run
    token
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\asyncio\base_events.py", line 573, in run_until_complete
    return future.result()
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\client.py", line 550, in _run
    await self.start()
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\client.py", line 562, in start
    await self._pre_loop()
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\client.py", line 83, in _pre_loop
    await self.me.fetch_all_favorites()
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\user.py", line 443, in fetch_all_favorites
    self.fetch_favorites, favorite_type=favorite_type)
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\util.py", line 19, in auto_page_coro
    response = await coro(*args, **kwargs)
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\user.py", line 426, in fetch_favorites
    favorites = await self.client.request.call("/favorites", params=params)
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\request.py", line 59, in call
    raise e.__class__(str(e))
vrcpy.errors.MissingCredentials: Missing Credentials
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x03F71530>
ERROR:asyncio:Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x042FB4C8>, 102370.406)]']
connector: <aiohttp.connector.TCPConnector object at 0x0431BFF0>

ManualLogin.py:

WARNING:root:VRC API Key has not been fetched, fetching
WS connected!
Traceback (most recent call last):
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\request.py", line 55, in call
    path, method, headers, params, jdict, no_auth, verify)
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\request.py", line 125, in _call
    "data": json if json is not None else content})
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\request.py", line 179, in raise_for_status
    switch[resp["response"].status]()
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\request.py", line 172, in <lambda>
    401: lambda: handle_401(),
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\request.py", line 159, in handle_401
    raise ClientErrors.MissingCredentials("Missing Credentials")
vrcpy.errors.MissingCredentials: Missing Credentials

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test10.py", line 38, in <module>
    loop.run_until_complete(main())
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\asyncio\base_events.py", line 573, in run_until_complete
    return future.result()
  File "test10.py", line 18, in main
    await client.start()
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\client.py", line 562, in start
    await self._pre_loop()
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\client.py", line 83, in _pre_loop
    await self.me.fetch_all_favorites()
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\user.py", line 443, in fetch_all_favorites
    self.fetch_favorites, favorite_type=favorite_type)
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\util.py", line 19, in auto_page_coro
    response = await coro(*args, **kwargs)
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\user.py", line 426, in fetch_favorites
    favorites = await self.client.request.call("/favorites", params=params)
  File "C:\Users\0000000000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\vrcpy\request.py", line 59, in call
    raise e.__class__(str(e))
vrcpy.errors.MissingCredentials: Missing Credentials
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x03F695B0>
ERROR:asyncio:Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x042BA4C8>, 102498.312)]']
connector: <aiohttp.connector.TCPConnector object at 0x03F696D0>

I can't seem to replicate this, can you tell me what version of vrcpy you are using? you can get the version via

import vrcpy
print(vrcpy.__version__)
royalroadprog commented 3 years ago

I can't seem to replicate this, can you tell me what version of vrcpy you are using? you can get the version via

import vrcpy
print(vrcpy.__version__)

It's 0.8.3

CaptainDestructo commented 3 years ago

Oh! There’s one more thing to check. When I first logged in with the API I had to go to my email and authorize the login from a new location. Have you done that?

iryis commented 3 years ago

From what I've tried it seems you also get vrcpy.errors.MissingCredentials: Missing Credentials or the Unauthorized from not having an account with a high enough trust..

more specifically: the account that gives no errors has a system_trust_trusted tag. Every other account I try w/o that tag also gives "Missing Credentials"

Account with system_trust_trusted (no errors using the latest repo version):

a replaced name is online!
a replaced name is online!
a replaced name is online!
Traceback (most recent call last):
  File "example.py", line 51, in <module>
    loop.run_until_complete(main())
  File "C:\Users\nope\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 603, in run_until_complete
    self.run_forever()
  File "C:\Users\nope\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 570, in run_forever
    self._run_once()
  File "C:\Users\nope\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 1823, in _run_once
    event_list = self._selector.select(timeout)
  File "C:\Users\nope\AppData\Local\Programs\Python\Python38\lib\selectors.py", line 323, in select
    r, w, _ = self._select(self._readers, self._writers, [], timeout)
  File "C:\Users\nope\AppData\Local\Programs\Python\Python38\lib\selectors.py", line 314, in _select
    r, w, x = select.select(r, w, w, timeout)
KeyboardInterrupt

Account with only system_trust_basic (Missing Credentials):

WARNING:root:VRC API Key has not been fetched, fetching
Traceback (most recent call last):
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\request.py", line 54, in call
    resp = await self._call(
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\request.py", line 123, in _call
    Request.raise_for_status(
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\request.py", line 179, in raise_for_status
    switch[resp["response"].status]()
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\request.py", line 172, in <lambda>
    401: lambda: handle_401(),
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\request.py", line 159, in handle_401
    raise ClientErrors.MissingCredentials("Missing Credentials")
vrcpy.errors.MissingCredentials: Missing Credentials

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "example.py", line 50, in <module>
    loop.run_until_complete(main())
  File "C:\Users\nope\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete
    return future.result()
  File "example.py", line 22, in main
    me = await client.fetch_me()
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\client.py", line 221, in fetch_me
    me = await self.request.call("/auth/user", **kwargs)
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\request.py", line 59, in call
    raise e.__class__(str(e))
vrcpy.errors.MissingCredentials: Missing Credentials
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000001898D993A00>
ERROR:asyncio:Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x000001898D974AC0>, 67848.453)]']
connector: <aiohttp.connector.TCPConnector object at 0x000001898D993BB0>

Account with no tags/visitor (Unauthorized):

WARNING:root:VRC API Key has not been fetched, fetching
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000002B7F2102790>
ERROR:asyncio:Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x000002B7F2173400>, 68919.671)]']
connector: <aiohttp.connector.TCPConnector object at 0x000002B7F2102C70>
Traceback (most recent call last):
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\request.py", line 54, in call
    resp = await self._call(
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\request.py", line 123, in _call
    Request.raise_for_status(
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\request.py", line 181, in raise_for_status
    resp["response"].raise_for_status()
  File "C:\Users\nope\Things\example\venv\lib\site-packages\aiohttp\client_reqrep.py", line 1000, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 401, message='Unauthorized', url=URL('https://api.vrchat.cloud/api/1/auth/user?apiKey=JlE5Jldo5Jibnk5O5hTx6XVqsJu4WJ26')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "example.py", line 50, in <module>
    loop.run_until_complete(main())
  File "C:\Users\nope\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete
    return future.result()
  File "example.py", line 11, in main
    await client.login(
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\client.py", line 366, in login
    resp = await self.request.call(
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\request.py", line 62, in call
    raise RequestErrors.RequestError(
vrcpy.errors.RequestError: 401, message='Unauthorized', url=URL('https://api.vrchat.cloud/api/1/auth/user?apiKey=JlE5Jldo5Jibnk5O5hTx6XVqsJu4WJ26') (1 retries)
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000002B7F2102790>
ERROR:asyncio:Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x000002B7F2139E20>, 68919.921)]']
connector: <aiohttp.connector.TCPConnector object at 0x000002B7F2102C70>

It may be fixable in the package but i'm not sure

Katistic commented 3 years ago

From what I've tried it seems you also get vrcpy.errors.MissingCredentials: Missing Credentials or the Unauthorized from not having an account with a high enough trust..

more specifically: the account that gives no errors has a system_trust_trusted tag. Every other account I try w/o that tag also gives "Missing Credentials"

Account with system_trust_trusted (no errors using the latest repo version):

a replaced name is online!
a replaced name is online!
a replaced name is online!
Traceback (most recent call last):
  File "example.py", line 51, in <module>
    loop.run_until_complete(main())
  File "C:\Users\nope\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 603, in run_until_complete
    self.run_forever()
  File "C:\Users\nope\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 570, in run_forever
    self._run_once()
  File "C:\Users\nope\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 1823, in _run_once
    event_list = self._selector.select(timeout)
  File "C:\Users\nope\AppData\Local\Programs\Python\Python38\lib\selectors.py", line 323, in select
    r, w, _ = self._select(self._readers, self._writers, [], timeout)
  File "C:\Users\nope\AppData\Local\Programs\Python\Python38\lib\selectors.py", line 314, in _select
    r, w, x = select.select(r, w, w, timeout)
KeyboardInterrupt

Account with only system_trust_basic (Missing Credentials):

WARNING:root:VRC API Key has not been fetched, fetching
Traceback (most recent call last):
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\request.py", line 54, in call
    resp = await self._call(
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\request.py", line 123, in _call
    Request.raise_for_status(
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\request.py", line 179, in raise_for_status
    switch[resp["response"].status]()
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\request.py", line 172, in <lambda>
    401: lambda: handle_401(),
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\request.py", line 159, in handle_401
    raise ClientErrors.MissingCredentials("Missing Credentials")
vrcpy.errors.MissingCredentials: Missing Credentials

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "example.py", line 50, in <module>
    loop.run_until_complete(main())
  File "C:\Users\nope\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete
    return future.result()
  File "example.py", line 22, in main
    me = await client.fetch_me()
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\client.py", line 221, in fetch_me
    me = await self.request.call("/auth/user", **kwargs)
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\request.py", line 59, in call
    raise e.__class__(str(e))
vrcpy.errors.MissingCredentials: Missing Credentials
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000001898D993A00>
ERROR:asyncio:Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x000001898D974AC0>, 67848.453)]']
connector: <aiohttp.connector.TCPConnector object at 0x000001898D993BB0>

Account with no tags/visitor (Unauthorized):

WARNING:root:VRC API Key has not been fetched, fetching
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000002B7F2102790>
ERROR:asyncio:Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x000002B7F2173400>, 68919.671)]']
connector: <aiohttp.connector.TCPConnector object at 0x000002B7F2102C70>
Traceback (most recent call last):
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\request.py", line 54, in call
    resp = await self._call(
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\request.py", line 123, in _call
    Request.raise_for_status(
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\request.py", line 181, in raise_for_status
    resp["response"].raise_for_status()
  File "C:\Users\nope\Things\example\venv\lib\site-packages\aiohttp\client_reqrep.py", line 1000, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 401, message='Unauthorized', url=URL('https://api.vrchat.cloud/api/1/auth/user?apiKey=JlE5Jldo5Jibnk5O5hTx6XVqsJu4WJ26')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "example.py", line 50, in <module>
    loop.run_until_complete(main())
  File "C:\Users\nope\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete
    return future.result()
  File "example.py", line 11, in main
    await client.login(
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\client.py", line 366, in login
    resp = await self.request.call(
  File "C:\Users\nope\Things\example\venv\lib\site-packages\vrcpy\request.py", line 62, in call
    raise RequestErrors.RequestError(
vrcpy.errors.RequestError: 401, message='Unauthorized', url=URL('https://api.vrchat.cloud/api/1/auth/user?apiKey=JlE5Jldo5Jibnk5O5hTx6XVqsJu4WJ26') (1 retries)
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000002B7F2102790>
ERROR:asyncio:Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x000002B7F2139E20>, 68919.921)]']
connector: <aiohttp.connector.TCPConnector object at 0x000002B7F2102C70>

It may be fixable in the package but i'm not sure

Thank you for this! I will test tomorrow

Katistic commented 3 years ago

https://github.com/vrchatapi/VRChatPython/issues/27#issuecomment-838748878

After testing with a new account, I still don't get these errors. image

iryis commented 3 years ago

That's weird, I made a new account just to try this and it has the same errors as before.. Any other ideas what the deal with that is?

Katistic commented 3 years ago

That's weird, I made a new account just to try this and it has the same errors as before.. Any other ideas what the deal with that is?

Could be aiohttp, what version aio are you using?

iryis commented 3 years ago

Could be aiohttp, what version aio are you using

it's the latest one from pypi - 3.7.4.post0

Katistic commented 3 years ago

Looks like aiohttp changed how headers or cookies are stored, I'll update it to use new versions of aiohttp tomorrow, until then stick to 3.6.3

iryis commented 3 years ago

Didn't know this used an older aiohttp. Upon downgrading I still get Missing Credentials no matter what account (except for the trusted tagged one I test on) Not getting Unauthorized anymore though so that may be good?