TodoLodo / cod-python-api

Call Of Duty API Library for python
https://cod-python-api.todolodo.xyz
GNU General Public License v3.0
54 stars 16 forks source link

RuntimeError: Event loop is closed #14

Closed youennwilson91 closed 1 year ago

youennwilson91 commented 1 year ago

Describe the bug

When I run the first few lines of the tutorial, i get a RuntimeError.

Here is my code :

  _import asyncio, datetime, requests, twine, urllib3, uuid, sphinx

  from cod_api import API, platforms
  api = API()
  api.login("USERS-SSO-TOKEN-EDITED-BY-TODOLODO-TO-HIDE-IT")
  profile = api.ModernWarfare2.fullData(platforms.PSN, "SkyRRoZ")
  print(profile)_

Here is the output:

  _C:\Users\youso\PycharmProjects\pythonProject56\venv\Scripts\python.exe C:/Users/youso/PycharmProjects/pythonProject56/main.py
  {'status': 'error', 'data': {'type': 'com.activision.mt.common.stdtools.exceptions.NoStackTraceException', 'message': 'Not permitted: not allowed'}}
  Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x0000023BF6492200>
  Traceback (most recent call last):
    File "C:\Users\youso\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 116, in __del__
      self.close()
    File "C:\Users\youso\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 108, in close
      self._loop.call_soon(self._call_connection_lost, None)
    File "C:\Users\youso\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 750, in call_soon
      self._check_closed()
    File "C:\Users\youso\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 515, in _check_closed
      raise RuntimeError('Event loop is closed')
  RuntimeError: Event loop is closed

  Process finished with exit code 0_

To Reproduce Steps to reproduce the behavior:

Just connect to the API and print any player profile.

Expected behavior I expected to get the full data on the player named "SkyRRoZ"

Screenshots

Desktop (please complete the following information):

Additional context

TodoLodo commented 1 year ago

The error message could be due to 2 reasons

  1. The SSO TOKEN is invalid
  2. The PSN ID is wrong

Regarding the Runtime error, the reproduce steps were followed but nothing similar was shown to the runtime error you got.

To help you further can you confirm the version of the library you have? (Use the following methods to check the version)

print(cod_api.version)


PS: The endpoints points for modernwarfare2 and warzone2 aren't active yet and the error message for this would be as follows
```bash
{'status': 'error', 'data': {'type': 'com.activision.mt.common.stdtools.exceptions.NoStackTraceException', 'message': 'Error from datastore'}}

Also pls edit your message to hide your SSO-TOKEN and hide your SSO-TOKEN in future issues as well

youennwilson91 commented 1 year ago

Hi,

My version is 2.0.1.

I checked my SSO_COOKIE on callofduty.com, it is correct. I used the username of the youtuber SkyRRoZ, on the PSN platform.

Nevertheless, my code is not working. I still have the RunTIme error.

RuntimeError: Event loop is closed {'status': 'error', 'data': {'type': 'com.activision.mt.common.stdtools.exceptions.NoStackTraceException', 'message': 'Not permitted: not allowed'}}

Please could you give me a valid token an a valid username so I can try ?

Thank you

TodoLodo commented 1 year ago

We did some test with a couple of psn usernames, other platforms usernames and fake usernames. Following is what we have narrowed down to.

So in this scenario the account does exist but due to how he has set his privacy in his account it is not allowing the api end point to return data

Hope this helps and this issue will be closed if further bugs rise please feel to draft a new issue ♡