OCHA-DAP / hdx-cli-toolkit

A commandline tool for interacting with HDX with a view to doing bulk updates
MIT License
1 stars 0 forks source link

get_organization_metadata fails #20

Closed IanHopkinson closed 8 months ago

IanHopkinson commented 8 months ago

The commandline:

hdx-toolkit get_organization_metadata --organization=zurich

Fails with the following:

***********************************************
* HDX CLI toolkit - Get organization Metadata *
* Invoked at: 2024-03-25T08:09:07.599238      *
***********************************************
Connected to HDX site https://stage.data-humdata-org.ahconu.org
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\users\ianho\.local\bin\hdx-toolkit.exe\__main__.py", line 7, in <module>
  File "C:\Users\ianho\AppData\Local\pipx\pipx\venvs\hdx-cli-toolkit\Lib\site-packages\click\core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ianho\AppData\Local\pipx\pipx\venvs\hdx-cli-toolkit\Lib\site-packages\click\core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "C:\Users\ianho\AppData\Local\pipx\pipx\venvs\hdx-cli-toolkit\Lib\site-packages\click\core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ianho\AppData\Local\pipx\pipx\venvs\hdx-cli-toolkit\Lib\site-packages\click\core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ianho\AppData\Local\pipx\pipx\venvs\hdx-cli-toolkit\Lib\site-packages\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ianho\code\2024\hdx-cli-toolkit\src\hdx_cli_toolkit\cli.py", line 256, in get_organization_metadata
    f"{organization['name']:<50.50}: {filtered_organization['id']}",
       ~~~~~~~~~~~~^^^^^^^^
TypeError: string indices must be integers, not 'str'
IanHopkinson commented 8 months ago

Fixed in #21