Skip to content
This repository was archived by the owner on Dec 20, 2021. It is now read-only.
This repository was archived by the owner on Dec 20, 2021. It is now read-only.

Unhandled format of the location string #17

@ShingenPizza

Description

@ShingenPizza

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions