Code Monkey home page Code Monkey logo

vrchatpython's People

Contributors

ariesclark avatar captaindestructo avatar ghostjumper avatar i-k0haku-i avatar katistic avatar shingenpizza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vrchatpython's Issues

Inconsistent behavior of Client.fetch_friends() and Client.fetch_full_friends()

fetch_friends() docstring has

offline, boolean
Get offline friends instead of online friends

and that's correct.

However, fetch_full_friends() docstring has

offline, boolean
Include offline friends or not

and that's wrong.
fetch_full_friends() uses fetch_friends() just once, passing all parameters there, so as a result fetch_full_friends(offline=True) does not include offline friends, but gets them instead.
Also the default value of offline is True in fetch_full_friends() and False in fetch_friends().

I suggest either
a) change the docstring and the default value of fetch_full_friends(),
b) or add an additional fetch_friends(offline=False) there to make it work the way it's described,
c) or, preferably, do a) + add an option to get both offline and online friends with one call by setting offline to None?

Add n and offset to fetch_avatars

I need to fetch many avatars at once, yet unless I'm missing something there is no option to change the n per the fetch_avatars response. I've changed fetch_avatars to complete this action, however do let me know if there is another way to accomplish what I've posed here!

    async def fetch_avatars(self, sort: SortType = SortType.UPDATED,
                            n: int = 60,
                            order: SortOrder = SortOrder.DESCENDING,
                            offset: int = 0,
                            release_status: ReleaseStatus = ReleaseStatus.ALL):
        """
        Fetches user owned avatars, returns list of :class:`vrcpy.Avatar`

        Keyword Arguments
        ------------------
        sort: :class:`vrcpy.SortType`
            How to sort avatars, defaults to ``SortType.UPDATED``
        n: :class:`int`
            The number of objects to return, defaults to 0, max 100.
        order: :class:`vrcpy.SortOrder`
            How to order sorted avatars, defaults to ``SortOrder.DESCENDING``
        offset: :class:`int`
            A zero-based offset from the default object sorting from where search results start. Default 0, min 0.
        release_status: :class:`vrcpy.ReleaseStatus`
            Return avatars only with this release status, defaults to ``ReleaseStatus.ALL``
        """

        avatars = await self.client.request.get("/avatars", params={
            "sort": sort.value,
            "n": n,
            "order": order.value,
            "offset": offset,
            "releaseStatus": release_status.value
        })
        return [Avatar(
            self.client, avatar, self.loop) for avatar in avatars["data"]]

Location information not available

Hi,
I'm having an issue with the rewrite code where all users' location data comes back as None. They aren't in private worlds according to the VRChat website, however User.location, User.world_id, and User.instance_id are all None.

Any assistance in figuring this out would be greatly appreciated. The location information is primarily what I need here.

Thanks

EDIT: Here's the last portion of the user object I'm getting:

    'last_login': '2020-12-12T12:49:15.026Z',
    'status': 'active',
    'bio': '',
    'location': None,
    'bio_links': [],
    'state': 'online',
    'friend_key': '###REDACTED###',
    'world_id': None,
    'instance_id': None,
    'allow_avatar_copying': False

Unhandled format of the location string

Yesterday I've received a message from my Telegram bot that monitors VRC activity of me and a group of my friends with an information that it failed to process a location string, in a way shown below:

>>> friends = client.fetch_full_friends(offline=False)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\Python38\lib\site-packages\vrcpy\client.py", line 66, in fetch_full_friends
    friends.append(friend.fetch_full())
  File "C:\Python38\lib\site-packages\vrcpy\objects.py", line 135, in fetch_full
    return User(self.client, resp["data"])
  File "C:\Python38\lib\site-packages\vrcpy\objects.py", line 202, in __init__
    if not obj == None: self._assign(obj)
  File "C:\Python38\lib\site-packages\vrcpy\objects.py", line 27, in _assign
    setattr(self, key, self.types[key](self.client, obj[key]))
  File "C:\Python38\lib\site-packages\vrcpy\objects.py", line 474, in __init__
    self.name, t, nonce = location.split("~")
ValueError: not enough values to unpack (expected 3, got 2)
>>> friends = client.fetch_friends(offline=False)
... for f in friends:
...     print(f.location)
...     
wrld_a015e11d-7ce8-42ed-8389-aa78104cff8c:7965~public

It's rare (happened only this one time during a couple of weeks), but it did happen. Would you like to add handling of this format and/or some kind of general error handling? If you're not feeling like doing it yourself i could create a pull request.

PS: is it intended that fetch_friends() leaves the .location as a string, while fetch_full_friends() turns it into a Location object? it doesn't request any additional data, so i don't know if it's necessary to leave it like that (although it did help me to find that invalid string).

Integrity error

WARNING:root:VRC API Key has not been fetched, fetching Traceback (most recent call last): File "e:\BioGenerator\profile_fetch_apid.py", line 49, in <module> loop.run_until_complete(main()) File "C:\Users\R\miniconda3\lib\asyncio\base_events.py", line 642, in run_until_complete return future.result() File "e:\BioGenerator\profile_fetch_apid.py", line 11, in main await client.login( File "C:\Users\R\miniconda3\lib\site-packages\vrcpy\client.py", line 387, in login self.me = CurrentUser(self, resp["data"], self.loop) File "C:\Users\R\miniconda3\lib\site-packages\vrcpy\user.py", line 358, in __init__ self._assign(obj) File "C:\Users\R\miniconda3\lib\site-packages\vrcpy\baseobject.py", line 25, in _assign self._object_integrety(obj) File "C:\Users\R\miniconda3\lib\site-packages\vrcpy\baseobject.py", line 89, in _object_integrety raise ObjectErrors.IntegretyError( vrcpy.errors.IntegretyError: CurrentUser object missing required key feature ERROR:asyncio:Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x00000296C4FCF880>

python 3.9.5
windows 10

Cannot login on Linux

It was able to log into VRC when testing on Windows 10. But when I run it on my Raspberry Pi, I got an "IntegretyError:CurrentUser object missing required key username" despite having a username,

Traceback (most recent call last): File "/home/pi/CheetoBot/cogs/vrchat.py", line 41, in connectVRC await self.vrcclient.login( File "/home/pi/.local/lib/python3.9/site-packages/vrcpy/client.py", line 383, in login self.me = CurrentUser(self, resp["data"], self.loop) File "/home/pi/.local/lib/python3.9/site-packages/vrcpy/user.py", line 382, in __init__ self._assign(obj) File "/home/pi/.local/lib/python3.9/site-packages/vrcpy/baseobject.py", line 27, in _assign self._object_integrety(obj) File "/home/pi/.local/lib/python3.9/site-packages/vrcpy/baseobject.py", line 91, in _object_integrety raise ObjectErrors.IntegretyError( vrcpy.errors.ObjectErrors.IntegretyError: CurrentUser object missing required key username

Python Version: 3.9.6
Platform: Linux-5.10.17-v7+-armv7l-with-glibc2.28

vrcpy.errors.IntegretyError - what to do?

I got the message "vrcpy.errors.IntegretyError: Object does not have unique key (pluginUrl) for World (Class definition may be outdated, please make an issue on github)" while running it through Heroku.

Can't run the login examples

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>

IntegretyError for fetching public instance

I tried using client.fetch_instance to get an instance object. While it worked for hidden instance IDs with the nonce key, it didn't work on any public instance IDs and got an IntegretyError instead

Traceback (most recent call last): File "C:\Users\Danny Grey\CheetoBot\vrclogin.py", line 100, in <module> loop.run_until_complete(main()) File "C:\Users\Danny Grey\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete return future.result() File "C:\Users\Danny Grey\CheetoBot\vrclogin.py", line 65, in main instance = await vrcclient.fetch_instance(worldid, instanceid) File "C:\Users\Danny Grey\AppData\Local\Programs\Python\Python39\lib\site-packages\vrcpy\client.py", line 224, in fetch_instance return Instance(self, instance["data"], self.loop) File "C:\Users\Danny Grey\AppData\Local\Programs\Python\Python39\lib\site-packages\vrcpy\world.py", line 258, in __init__ self._assign(obj) File "C:\Users\Danny Grey\AppData\Local\Programs\Python\Python39\lib\site-packages\vrcpy\baseobject.py", line 25, in _assign self._object_integrety(obj) File "C:\Users\Danny Grey\AppData\Local\Programs\Python\Python39\lib\site-packages\vrcpy\baseobject.py", line 89, in _object_integrety raise ObjectErrors.IntegretyError( vrcpy.errors.IntegretyError: Instance object missing required key hidden ERROR:asyncio:Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x000001F390E422B0> ERROR:asyncio:Unclosed connector connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x000001F390E43520>, 242321.453)]', '[(<aiohttp.client_proto.ResponseHandler object at 0x000001F390E92520>, 242323.593), (<aiohttp.client_proto.ResponseHandler object at 0x000001F390EBE5E0>, 242324.125), (<aiohttp.client_proto.ResponseHandler object at 0x000001F390EBEF40>, 242324.125), (<aiohttp.client_proto.ResponseHandler object at 0x000001F390E92880>, 242324.14), (<aiohttp.client_proto.ResponseHandler object at 0x000001F390E92B20>, 242334.265)]'] connector: <aiohttp.connector.TCPConnector object at 0x000001F390E421F0>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.