Gnomeslayer / battlemetrics

3 stars 0 forks source link

Player search error #8

Open rodrigo-apoc opened 4 days ago

rodrigo-apoc commented 4 days ago

Trying to run: asyncio.run(api.player.search('Apoc',29468036))

Getting the following error:

Traceback (most recent call last): File "...bot.py", line 9, in server_info = asyncio.run(api.player.search('Apoc',29468036)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\asyncio\runners.py", line 190, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\asyncio\runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "C:\Users\NAME\AppData\Roaming\Python\Python311\site-packages\battlemetrics\components\player.py", line 68, in search data['server']['game'] = filter_game


KeyError: 'server'
Gnomeslayer commented 1 day ago

Thank you for reporting this issue. I will look at it today or tomorrow and get back to you. If you want to contact me directly, you can message me on discord - @gnomeslayer - When I fix this issue I will update you here regardless.

Gnomeslayer commented 1 day ago

After reviewing the code, the "filter_game" option was no longer in the original api, at least not the way it's suppose to be. I've removed it from the repo and will update the pip install soon.

In regards to what you're trying to do, it does appear you're trying to filter by server? if so you should probably try: response = asyncio.run(api.player.search(search="Apoc", filter_servers=29468036))

rodrigo-apoc commented 11 hours ago

Thank you for the response. I tested the same code and I got another error:

{
    "errors": [
        {
            "keyword": "type",
            "dataPath": ".filter.server",
            "schemaPath": "#/properties/filter/properties/server/type",
            "params": {
                "type": "object"
            },
            "message": "should be object"
        }
    ],
    "meta": {
        "schema": {
            "$ref": "battlemetrics#/definitions/player/links/0/schema"
        }
    }
}
{'errors': [{'keyword': 'type', 'dataPath': '.filter.server', 'schemaPath': '#/properties/filter/properties/server/type', 'params': {'type': 'object'}, 'message': 'should be object'}], 'meta': {'schema': {'$ref': 'battlemetrics#/definitions/player/links/0/schema'}}}