ngrok / ngrok-api-python

ngrok API client library for Python
MIT License
24 stars 14 forks source link

fix(datatypes): fixing nonetype error #10

Closed russorat closed 2 years ago

russorat commented 2 years ago

Trying to run:

for e in ng.endpoint_configurations.list():
    print(e)

I kept getting TypeError: 'NoneType' object is not subscriptable

This fixes that issue for the objects i was using, but there might be more.

russorat commented 2 years ago

updated to also fix an issue when listing domain names:

Traceback (most recent call last):
  File "/Users/rsavage/workspace/ngrok-playground/./main.py", line 30, in <module>
    for d in ng.reserved_domains.list():
  File "/Users/rsavage/workspace/ngrok-playground/venv/lib/python3.9/site-packages/ngrok/services.py", line 2268, in list
    return ReservedDomainList(self._client, result)
  File "/Users/rsavage/workspace/ngrok-playground/venv/lib/python3.9/site-packages/ngrok/datatypes.py", line 2460, in __init__
    self._props["reserved_domains"] = [
  File "/Users/rsavage/workspace/ngrok-playground/venv/lib/python3.9/site-packages/ngrok/datatypes.py", line 2461, in <listcomp>
    ReservedDomain(client, x) for x in props["reserved_domains"]
  File "/Users/rsavage/workspace/ngrok-playground/venv/lib/python3.9/site-packages/ngrok/datatypes.py", line 2370, in __init__
    self._props["certificate_management_status"] = ReservedDomainCertStatus(
  File "/Users/rsavage/workspace/ngrok-playground/venv/lib/python3.9/site-packages/ngrok/datatypes.py", line 2521, in __init__
    self._props["provisioning_job"] = ReservedDomainCertJob(
  File "/Users/rsavage/workspace/ngrok-playground/venv/lib/python3.9/site-packages/ngrok/datatypes.py", line 2577, in __init__
    ReservedDomainCertNSTarget(client, x) for x in props["ns_targets"]
TypeError: 'NoneType' object is not subscriptable
inconshreveable commented 2 years ago

it's definitely odd that None is getting passed in as props here, that shouldn't be happening. we'll take a closer look. did the domains error replicate with just nd.reserved_domains.list()?

russorat commented 2 years ago

yeah, i was just doing for d in ng.reserved_domains.list():