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

TypeError: 'str' object is not callable when GitHub 500s #2958

Open
bakert opened this issue Apr 24, 2024 · 0 comments
Open

TypeError: 'str' object is not callable when GitHub 500s #2958

bakert opened this issue Apr 24, 2024 · 0 comments

Comments

@bakert
Copy link

bakert commented Apr 24, 2024

Encountered this a couple of times today during GitHub's (currently ongoing) prod issues. The library probably wants to be robust to this/at least throw its own exception rather than a TypeError?

File "/home/pdadmin/decksite/.venv/lib/python3.10/site-packages/github/Requester.py", line 528, in __createException
    message = output.get("message", "").lower() if output is not None else ""
      self = <github.Requester.Requester object at 0x7fb440ae78b0>
      status = 500
      headers = <exception while printing> Traceback (most recent call last):
          File "/home/pdadmin/decksite/.venv/lib/python3.10/site-packages/traceback_with_variables/core.py", line 222, in _to_cropped_str
            raw = print_(obj)
        TypeError: 'str' object is not callable
        
      output = [{'url': 'https://api.github.com/repos/PennyDreadfulMTG/Penny-Dreadful-Tools/pulls/11982', 'id': 1731819095, 'node_id': 'PR_kwDOBCHlNs5nOXZX', 'html_url': 'https://github.com/PennyDreadfulMTG/Penny-Dreadful-Tools/pull/11982', 'diff_url': 'https://github.com/PennyDreadfulMTG/Penny-Dreadful-Tools/pull/11982.diff', 'patch_url': 'https://github.com/PennyDreadfulMTG/Penny-Dreadful-Tools/pull/11982.patch', 'issue_url': 'https://api.github.com/repos/PennyDreadfulMTG/Penny-Dreadful-Tools/issues/11982', 'number': 11982, 'state': 'closed', 'locked': False, 'title': 'build(deps): bump urllib3 from 2.1.0 to 2.2.1', 'user': {'login': 'dependabot[bot]', 'id': 49699333, 'node_id': 'MDM6Qm90NDk2OTkzMzM=', 'avatar_url': 'https://avatars.githubusercontent.com/in/29110?v=4', 'gravatar_id': '', 'url': 'https://api.github.com/users/dependabot%5Bbot%5D', 'html_url': 'https://github.com/apps/dependabot', 'followers_url': 'https://api.github.com/users/dependabot%5Bbot%5D/followers', 'following_url': 'https://...
builtins.AttributeError: 'list' object has no attribute 'get'

Full stack trace in case it's useful:

Traceback with variables (most recent call last):
  File "/home/pdadmin/decksite/run.py", line 132, in task
    run_all_tasks(module, 'HOURLY')
      args = ['maintenance', 'hourly']
      module = 'maintenance'
      name = 'hourly'
      multiverse = <module 'magic.multiverse' from '/home/pdadmin/decksite/magic/multiverse.py'>
      oracle = <module 'magic.oracle' from '/home/pdadmin/decksite/magic/oracle.py'>
      c = AttributeError("'list' object has no attribute 'get'")
      repo = <module 'shared.repo' from '/home/pdadmin/decksite/shared/repo.py'>
  File "/home/pdadmin/decksite/run.py", line 198, in run_all_tasks
    raise error
      module = 'maintenance'
      with_flag = 'HOURLY'
      error = AttributeError("'list' object has no attribute 'get'")
      m = <module 'maintenance' from '/home/pdadmin/decksite/maintenance/__init__.py'>
      APP = <PDFlask 'decksite'>
      _importer = FileFinder('/home/pdadmin/decksite/maintenance')
      modname = 'validate_translations_test'
      _ispkg = False
      s = <module 'maintenance.validate_translations_test' from '/home/pdadmin/decksite/maintenance/validate_translations_test.py'>
      timer = 34924607.489579886
      t = 0.0008053556084632874
      repo = <module 'shared.repo' from '/home/pdadmin/decksite/shared/repo.py'>
  File "/home/pdadmin/decksite/run.py", line 189, in run_all_tasks
    s.run()
      module = 'maintenance'
      with_flag = 'HOURLY'
      error = AttributeError("'list' object has no attribute 'get'")
      m = <module 'maintenance' from '/home/pdadmin/decksite/maintenance/__init__.py'>
      APP = <PDFlask 'decksite'>
      _importer = FileFinder('/home/pdadmin/decksite/maintenance')
      modname = 'validate_translations_test'
      _ispkg = False
      s = <module 'maintenance.validate_translations_test' from '/home/pdadmin/decksite/maintenance/validate_translations_test.py'>
      timer = 34924607.489579886
      t = 0.0008053556084632874
      repo = <module 'shared.repo' from '/home/pdadmin/decksite/shared/repo.py'>
  File "/home/pdadmin/decksite/maintenance/homepage_cache.py", line 12, in run
    merges = news.code_merges(start_date, end_date, force_refresh=True)
      start_date = datetime.datetime(2024, 2, 16, 8, 0, tzinfo=<UTC>)
      end_date = datetime.datetime(2024, 4, 24, 10, 45, 6, 961737, tzinfo=datetime.timezone.utc)
  File "/home/pdadmin/decksite/decksite/data/news.py", line 61, in code_merges
    merges = [Container({'date': dtutil.UTC_TZ.localize(pull.merged_at), 'title': pull.title, 'url': pull.html_url, 'type': 'code-release'}) for pull in repo.get_pull_requests(start_date, end_date, max_items) if 'Not News' not in [[label.name](http://label.name/) for label in pull.as_issue().labels]]
      start_date = datetime.datetime(2024, 2, 16, 8, 0, tzinfo=<UTC>)
      end_date = datetime.datetime(2024, 4, 24, 10, 45, 6, 961737, tzinfo=datetime.timezone.utc)
      max_items = 9223372036854775807
      force_refresh = True
      allow_fetch = True
      merges = []
  File "/home/pdadmin/decksite/shared/repo.py", line 132, in get_pull_requests
    for pull in git_repo.get_pulls(state='closed', sort='updated', direction='desc'):
      start_date = datetime.datetime(2024, 2, 16, 8, 0, tzinfo=<UTC>)
      end_date = datetime.datetime(2024, 4, 24, 10, 45, 6, 961737, tzinfo=datetime.timezone.utc)
      max_pull_requests = 9223372036854775807
      repo_name = 'PennyDreadfulMTG/Penny-Dreadful-Tools'
      gh_user = 'REDACTED'
      gh_pass = 'REDACTED'
      pulls = [PullRequest(title="Revamp achievements detail page", number=12260), PullRequest(title="build(deps): bump inflect from 7.2.0 to 7.2.1", number=12267), PullRequest(title="build(deps): bump pydantic from 2.7.0 to 2.7.1", number=12268), PullRequest(title="build(deps): bump freezegun from 1.4.0 to 1.5.0", number=12266), PullRequest(title="build(deps): bump coverage from 7.4.4 to 7.5.0", number=12265), PullRequest(title="build(deps): bump pydantic-core from 2.18.1 to 2.18.2", number=12264), PullRequest(title="build(deps): bump google-api-python-client from 2.126.0 to 2.127.0", number=12263), PullRequest(title="build(deps): bump types-setuptools from 69.5.0.20240415 to 69.5.0.20240423", number=12262), PullRequest(title="Support is:outlaw in card search", number=12259), PullRequest(title="isort --fix the current codebase", number=12258), PullRequest(title="Return card mouseover to working order on /rotation", number=12255), PullRequest(title="Saner behavior for rank sort", number=12254), Pull...
      g = <github.MainClass.Github object at 0x7fb440d2c070>
      git_repo = Repository(full_name="PennyDreadfulMTG/Penny-Dreadful-Tools")
      pull = PullRequest(title="build(deps): bump types-setuptools from 69.1.0.20240215 to 69.1.0.20240217", number=11984)
      merged_dt = datetime.datetime(2024, 2, 18, 20, 27, 33, tzinfo=<UTC>)
      updated_dt = datetime.datetime(2024, 2, 18, 20, 27, 33, tzinfo=<UTC>)
  File "/home/pdadmin/decksite/.venv/lib/python3.10/site-packages/github/PaginatedList.py", line 69, in __iter__
    newElements = self._grow()
      self = <github.PaginatedList.PaginatedList object at 0x7fb440b36b90>
      newElements = [PullRequest(title="build(deps): bump pydantic from 2.6.2 to 2.6.3", number=12018), PullRequest(title="build(deps): bump sentry-sdk from 1.40.5 to 1.40.6", number=12017), PullRequest(title="build(deps): bump cachetools from 5.3.2 to 5.3.3", number=12016), PullRequest(title="build(deps): bump typing-extensions from 4.9.0 to 4.10.0", number=12015), PullRequest(title="build(deps): bump pydantic from 2.6.1 to 2.6.2", number=12014), PullRequest(title="build(deps): bump coverage from 7.4.2 to 7.4.3", number=12010), PullRequest(title="build(deps): bump types-setuptools from 69.1.0.20240217 to 69.1.0.20240223", number=12012), PullRequest(title="build(deps-dev): bump eslint from 8.56.0 to 8.57.0", number=12013), PullRequest(title="build(deps): bump importlib-resources from 6.1.1 to 6.1.2", number=12011), PullRequest(title="build(deps): bump orjson from 3.9.14 to 3.9.15", number=12009), PullRequest(title="build(deps): bump pydantic-core from 2.16.2 to 2.16.3", number=12007), PullRequest(title="b...
  File "/home/pdadmin/decksite/.venv/lib/python3.10/site-packages/github/PaginatedList.py", line 80, in _grow
    newElements = self._fetchNextPage()
      self = <github.PaginatedList.PaginatedList object at 0x7fb440b36b90>
  File "/home/pdadmin/decksite/.venv/lib/python3.10/site-packages/github/PaginatedList.py", line 213, in _fetchNextPage
    headers, data = self.__requester.requestJsonAndCheck(
      self = <github.PaginatedList.PaginatedList object at 0x7fb440b36b90>
  File "/home/pdadmin/decksite/.venv/lib/python3.10/site-packages/github/Requester.py", line 442, in requestJsonAndCheck
    return self.__check(
      self = <github.Requester.Requester object at 0x7fb440ae78b0>
      verb = 'GET'
      url = 'https://api.github.com/repositories/69330230/pulls?state=closed&sort=updated&direction=desc&page=8'
      parameters = None
      headers = <exception while printing> Traceback (most recent call last):
          File "/home/pdadmin/decksite/.venv/lib/python3.10/site-packages/traceback_with_variables/core.py", line 222, in _to_cropped_str
            raw = print_(obj)
        TypeError: 'str' object is not callable
        
      input = None
  File "/home/pdadmin/decksite/.venv/lib/python3.10/site-packages/github/Requester.py", line 487, in __check
    raise self.__createException(status, responseHeaders, data)
      self = <github.Requester.Requester object at 0x7fb440ae78b0>
      status = 500
      responseHeaders = {'server': 'GitHub.com', 'date': 'Wed, 24 Apr 2024 10:45:19 GMT', 'content-type': 'application/json; charset=utf-8', 'content-length': '762897', 'cache-control': 'private, max-age=60, s-maxage=60', 'vary': 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, X-Requested-With', 'etag': '"2ac1999983609d975294ffd7ef63e08a5b54a2a008dfc6a021df86406e6e5ded"', 'x-oauth-scopes': 'repo', 'x-accepted-oauth-scopes': '', 'x-github-media-type': 'github.v3; format=json', 'link': '<https://api.github.com/repositories/69330230/pulls?state=closed&sort=updated&direction=desc&page=7>; rel="prev", <https://api.github.com/repositories/69330230/pulls?state=closed&sort=updated&direction=desc&page=9>; rel="next", <https://api.github.com/repositories/69330230/pulls?state=closed&sort=updated&direction=desc&page=193>; rel="last", <https://api.github.com/repositories/69330230/pulls?state=closed&sort=updated&direction=desc&page=1>; rel="first"', 'x-github-api-version-selected': '2022-11-28', 'x-r...
      output = '[{"url":"https://api.github.com/repos/PennyDreadfulMTG/Penny-Dreadful-Tools/pulls/11982","id":1731819095,"node_id":"PR_kwDOBCHlNs5nOXZX","html_url":"https://github.com/PennyDreadfulMTG/Penny-Dreadful-Tools/pull/11982","diff_url":"https://github.com/PennyDreadfulMTG/Penny-Dreadful-Tools/pull/11982.diff","patch_url":"https://github.com/PennyDreadfulMTG/Penny-Dreadful-Tools/pull/11982.patch","issue_url":"https://api.github.com/repos/PennyDreadfulMTG/Penny-Dreadful-Tools/issues/11982","number":11982,"state":"closed","locked":false,"title":"build(deps): bump urllib3 from 2.1.0 to 2.2.1","user":{"login":"dependabot[bot]","id":49699333,"node_id":"MDM6Qm90NDk2OTkzMzM=","avatar_url":"https://avatars.githubusercontent.com/in/29110?v=4","gravatar_id":"","url":"https://api.github.com/users/dependabot%5Bbot%5D","html_url":"https://github.com/apps/dependabot","followers_url":"https://api.github.com/users/dependabot%5Bbot%5D/followers","following_url":"https://api.github.com/users/dependabot%5Bbot%5...
      data = [{'url': 'https://api.github.com/repos/PennyDreadfulMTG/Penny-Dreadful-Tools/pulls/11982', 'id': 1731819095, 'node_id': 'PR_kwDOBCHlNs5nOXZX', 'html_url': 'https://github.com/PennyDreadfulMTG/Penny-Dreadful-Tools/pull/11982', 'diff_url': 'https://github.com/PennyDreadfulMTG/Penny-Dreadful-Tools/pull/11982.diff', 'patch_url': 'https://github.com/PennyDreadfulMTG/Penny-Dreadful-Tools/pull/11982.patch', 'issue_url': 'https://api.github.com/repos/PennyDreadfulMTG/Penny-Dreadful-Tools/issues/11982', 'number': 11982, 'state': 'closed', 'locked': False, 'title': 'build(deps): bump urllib3 from 2.1.0 to 2.2.1', 'user': {'login': 'dependabot[bot]', 'id': 49699333, 'node_id': 'MDM6Qm90NDk2OTkzMzM=', 'avatar_url': 'https://avatars.githubusercontent.com/in/29110?v=4', 'gravatar_id': '', 'url': 'https://api.github.com/users/dependabot%5Bbot%5D', 'html_url': 'https://github.com/apps/dependabot', 'followers_url': 'https://api.github.com/users/dependabot%5Bbot%5D/followers', 'following_url': 'https://...
  File "/home/pdadmin/decksite/.venv/lib/python3.10/site-packages/github/Requester.py", line 528, in __createException
    message = output.get("message", "").lower() if output is not None else ""
      self = <github.Requester.Requester object at 0x7fb440ae78b0>
      status = 500
      headers = <exception while printing> Traceback (most recent call last):
          File "/home/pdadmin/decksite/.venv/lib/python3.10/site-packages/traceback_with_variables/core.py", line 222, in _to_cropped_str
            raw = print_(obj)
        TypeError: 'str' object is not callable
        
      output = [{'url': 'https://api.github.com/repos/PennyDreadfulMTG/Penny-Dreadful-Tools/pulls/11982', 'id': 1731819095, 'node_id': 'PR_kwDOBCHlNs5nOXZX', 'html_url': 'https://github.com/PennyDreadfulMTG/Penny-Dreadful-Tools/pull/11982', 'diff_url': 'https://github.com/PennyDreadfulMTG/Penny-Dreadful-Tools/pull/11982.diff', 'patch_url': 'https://github.com/PennyDreadfulMTG/Penny-Dreadful-Tools/pull/11982.patch', 'issue_url': 'https://api.github.com/repos/PennyDreadfulMTG/Penny-Dreadful-Tools/issues/11982', 'number': 11982, 'state': 'closed', 'locked': False, 'title': 'build(deps): bump urllib3 from 2.1.0 to 2.2.1', 'user': {'login': 'dependabot[bot]', 'id': 49699333, 'node_id': 'MDM6Qm90NDk2OTkzMzM=', 'avatar_url': 'https://avatars.githubusercontent.com/in/29110?v=4', 'gravatar_id': '', 'url': 'https://api.github.com/users/dependabot%5Bbot%5D', 'html_url': 'https://github.com/apps/dependabot', 'followers_url': 'https://api.github.com/users/dependabot%5Bbot%5D/followers', 'following_url': 'https://...
builtins.AttributeError: 'list' object has no attribute 'get'
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

1 participant