response icon indicating copy to clipboard operation
response copied to clipboard

fixed No user found then Slack API paginates

Open potapum opened this issue 5 years ago • 3 comments

If Slack workspace contains more than 1000 user, "users.list" API call response will be paginated. users_list function did not accounted for this. If INCIDENT_BOT_NAME username is not on first page, application will throw

  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.7/site-packages/django/core/management/__init__.py", line 345, in execute
    settings.INSTALLED_APPS
  File "/usr/local/lib/python3.7/site-packages/django/conf/__init__.py", line 76, in __getattr__
    self._setup(name)
  File "/usr/local/lib/python3.7/site-packages/django/conf/__init__.py", line 63, in _setup
    self._wrapped = Settings(settings_module)
  File "/usr/local/lib/python3.7/site-packages/django/conf/__init__.py", line 142, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/opt/project/myincidentresponse/settings.py", line 185, in <module>
    INCIDENT_BOT_NAME
  File "/usr/local/lib/python3.7/site-packages/response/slack/client.py", line 79, in get_user_id
    raise SlackError(f"User '{name}' not found")
response.slack.client.SlackError: User '<userbame>' not found```

potapum avatar Jan 28 '20 16:01 potapum

Hello @mattrco, Could you take a look at this PR?

potapum avatar Mar 04 '20 13:03 potapum

Hi we had the same issue. Would been for you to merge this and it works with ours too.

alanakirby avatar Sep 17 '20 23:09 alanakirby

@ChrisAnn @evnsio @milesbxf Any ideas when this can be merged? Need it in the module

alanakirby avatar Oct 01 '20 00:10 alanakirby