Skip to content

OSError: [Errno 98] Address already in use #24

Description

@rish-hyun

I'm trying to run these samples in colab, but it throw this error:

Waiting for authorization and callback to: http://127.0.0.1:8080/...
Traceback (most recent call last):
  File "/content/v1/list_apps.py", line 81, in <module>
    main()
  File "/content/v1/list_apps.py", line 76, in main
    service = admob_utils.authenticate()
  File "/content/v1/admob_utils.py", line 99, in authenticate
    code = _get_authorization_code(passthrough_val)
  File "/content/v1/admob_utils.py", line 129, in _get_authorization_code
    sock.bind(("localhost", PORT))
OSError: [Errno 98] Address already in use

Steps:

! pip install --upgrade google-api-python-client
! pip install --upgrade google-auth-oauthlib
! git clone https://github.com/googleads/googleads-admob-api-samples.git
! cp -r /content/googleads-admob-api-samples/python/v1 .
! rm -rf /content/googleads-admob-api-samples
client_secrets = {
  "installed": {
    "client_id": "xxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com",
    "client_secret": "xxxxxxxx-xxxxxxxxxxxxxxxxxxxx_xxxxx__xxxxx",
    "auth_uri": "https://accounts.google.com/o/oauth2/auth",
    "token_uri": "https://oauth2.googleapis.com/token"
  }
}

import json
with open('v1/client_secrets.json', 'w') as fp:
    json.dump(client_secrets, fp)
! python /content/v1/list_apps.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions