Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Name or Service not known' when running #37

Closed
kaltec-w opened this issue Sep 1, 2023 · 3 comments
Closed

'Name or Service not known' when running #37

kaltec-w opened this issue Sep 1, 2023 · 3 comments

Comments

@kaltec-w
Copy link

kaltec-w commented Sep 1, 2023

Hello,

I just cloned the repo and am following the directions to run the tool to collect the AH data. I successfully created a dev account and am using the following command to run (in a VENV):

BN_CLIENT_ID="<omitted>" BN_CLIENT_SECRET="<omitted>" python -m ah.updater --game_version classic us

Here's the error message I get:

Traceback (most recent call last):
  File "/home/myuser/git/TSM-Backend/lib/python3.11/site-packages/urllib3/connection.py", line 174, in _new_conn
    conn = connection.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/myuser/git/TSM-Backend/lib/python3.11/site-packages/urllib3/util/connection.py", line 72, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/socket.py", line 962, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/myuser/git/TSM-Backend/lib/python3.11/site-packages/urllib3/connectionpool.py", line 714, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "/home/myuser/git/TSM-Backend/lib/python3.11/site-packages/urllib3/connectionpool.py", line 403, in _make_request
    self._validate_conn(conn)
  File "/home/myuser/git/TSM-Backend/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1053, in _validate_conn
    conn.connect()
  File "/home/myuser/git/TSM-Backend/lib/python3.11/site-packages/urllib3/connection.py", line 363, in connect
    self.sock = conn = self._new_conn()
                       ^^^^^^^^^^^^^^^^
  File "/home/myuser/git/TSM-Backend/lib/python3.11/site-packages/urllib3/connection.py", line 186, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f76179cf890>: Failed to establish a new connection: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/myuser/git/TSM-Backend/lib/python3.11/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/home/myuser/git/TSM-Backend/lib/python3.11/site-packages/urllib3/connectionpool.py", line 798, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/home/myuser/git/TSM-Backend/lib/python3.11/site-packages/urllib3/util/retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='regionenum.us.api.blizzard.com', port=443): Max retries exceeded with url: /data/wow/connected-realm/index?namespace=dynamic-classic1x-us&locale=en_US&access_token=<ommitted> (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f76179cf890>: Failed to establish a new connection: [Errno -2] Name or service not known'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/myuser/git/TSM-Backend/ah/updater.py", line 198, in <module>
    main(**vars(args))
  File "/home/myuser/git/TSM-Backend/ah/updater.py", line 163, in main
    start_ts, end_ts = task_manager.update_region_dbs(namespace)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/myuser/git/TSM-Backend/ah/updater.py", line 70, in update_region_dbs
    for crid in crids:
  File "/home/myuser/git/TSM-Backend/ah/api.py", line 95, in pull_connected_realms_ids
    connected_realms = self.wrapper.get_connected_realms_index(namespace)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/myuser/git/TSM-Backend/ah/cache.py", line 100, in inner
    value = func(that, *args, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/myuser/git/TSM-Backend/ah/api.py", line 28, in get_connected_realms_index
    return self._api.wow.game_data.get_connected_realms_index(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/myuser/git/TSM-Backend/ah/vendors/blizzardapi/wow/wow_game_data_api.py", line 112, in get_connected_realms_index
    return super().get_resource(resource, region, query_params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/myuser/git/TSM-Backend/ah/vendors/blizzardapi/api.py", line 85, in get_resource
    return self._request_handler(url, region, query_params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/myuser/git/TSM-Backend/ah/vendors/blizzardapi/api.py", line 69, in _request_handler
    response = self._session.get(url, params=query_params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/myuser/git/TSM-Backend/lib/python3.11/site-packages/requests/sessions.py", line 555, in get
    return self.request('GET', url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/myuser/git/TSM-Backend/lib/python3.11/site-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/myuser/git/TSM-Backend/lib/python3.11/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/myuser/git/TSM-Backend/lib/python3.11/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='regionenum.us.api.blizzard.com', port=443): Max retries exceeded with url: /data/wow/connected-realm/index?namespace=dynamic-classic1x-us&locale=en_US&access_token=<ommitted> (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f76179cf890>: Failed to establish a new connection: [Errno -2] Name or service not known'))

It looks like it's trying to connect to 'regionenum.us.api.blizzard.com', which is not a valid host. Any suggestions on resolving this issue?

@kamoo1
Copy link
Owner

kamoo1 commented Sep 3, 2023

Thank you for the report,

It seems to be a serialization issue when str(RegionEnum.US) gives regionenum.us.

You can find the definition of RegionEnum here:
https://github.com/kamoo1/TSM-Backend/blob/2638bb5439670d93d1adc262a7659f87992a26ff/ah/models/blizzard.py#L57

I haven't run into this myself, though it doesn't seem likely, python version could be a factor. Could give python3.10 a try? If that fixed the problem you have, please let me know, thanks!

@kamoo1 kamoo1 closed this as completed Sep 3, 2023
@kamoo1 kamoo1 reopened this Sep 3, 2023
@kamoo1
Copy link
Owner

kamoo1 commented Sep 3, 2023

That was indeed the cause, I'll look for a solution.
python/cpython#100458

kamoo1 added a commit that referenced this issue Sep 3, 2023
@kamoo1 kamoo1 closed this as completed Sep 4, 2023
@kamoo1
Copy link
Owner

kamoo1 commented Sep 4, 2023

Hey @kaltec-w, I have pushed the fix in e20b58d (dev)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants