Python Forum
API Post issue "TypeError: 'str' object is not callable"
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
API Post issue "TypeError: 'str' object is not callable"
#2
your strings must be enclosed in single or double quotes.
here's a display routine that accesses all nodes of structure:
ipstructure = {'name': 'xxxx', 'ipv4_start': 'xxxx', 'ipv4_cidr': 'xx', 'ipv4_address_domain_id': 'xxxx', 'INFO-ipv4_address_domain_name': 'xxxx', 'ipv4_address_domain_range_id': 'xxxx', 'INFO-ipv4_address_domain_range_name': 'xxxxx', 'ipv4_allocation_template_id': 'xxxx', 'dhcp_relay_id': '', 'ipv6_start': 'xxxx::', 'ipv6_cidr': 64.0, 'ipv6_address_domain_id': 'xxxx', 'INFO-ipv6_address_domain_id': 'xxxxx', 'ipv6_address_domain_range_id': 'xxxxx', 'INFO-ipv6_address_domain_range_name': 'xxxxxx::/49', 'ipv6_allocation_template_id': 'xxxx', 'dhcpv6_relay_id': '', 'l2_vni_value': '', 'INFO-l2_vni_name': '', 'l2_domain_id': '', 'INFO-l2_domain_name': '', 'dns_domain_id': '', 'INFO-dns_domain_name': '', 'is_infoblox_synced': 'xxxx', 'is_private': 'xxxx', 'tenant_id': 'xxxx', 'INFO-tenant_name': 'xxxx', 'partition_id': 'xxxx', 'INFO-partition_name': 'xxxx', 'provider_id': 'xxxx', 'INFO-provider_name': 'xxxxx', 'consumer_id': 'xxxx', 'INFO-resp_consumer_name': 'xxxx', 'other_consumers': '', 'INFO-other_consumer_names': '', 'vlan_tag': 'xxxx', 'INFO-vlan_name': '', 'description': '', 'hashtags': '', 'discovery_organization_id': '', 'INFO-discovery_organization_name': 'xxxx', 'discovery_credential_id': '', 'INFO-discovery_credential_name': 'xxxx', 'discovery_scanner_id': '', 'INFO-discovery_scanner_name': 'xxxx', 'discovery_exclude_justification': 'xxxx', 'INFO-Comments-Notes': ''}

def display_dict(dictname, level=0):
    indent = " " * (4 * level)
    for key, value in dictname.items():
        if isinstance(value, dict):
            print(f'\n{indent}{key}')
            level += 1
            self.display_dict(value, level)
        else:
            print(f'{indent}{key}: {value}')
        if level > 0:
            level -= 1

display_dict(ipstructure)
Results:
Output:
name: xxxx ipv4_start: xxxx ipv4_cidr: xx ipv4_address_domain_id: xxxx INFO-ipv4_address_domain_name: xxxx ipv4_address_domain_range_id: xxxx INFO-ipv4_address_domain_range_name: xxxxx ipv4_allocation_template_id: xxxx dhcp_relay_id: ipv6_start: xxxx:: ipv6_cidr: 64.0 ipv6_address_domain_id: xxxx INFO-ipv6_address_domain_id: xxxxx ipv6_address_domain_range_id: xxxxx INFO-ipv6_address_domain_range_name: xxxxxx::/49 ipv6_allocation_template_id: xxxx dhcpv6_relay_id: l2_vni_value: INFO-l2_vni_name: l2_domain_id: INFO-l2_domain_name: dns_domain_id: INFO-dns_domain_name: is_infoblox_synced: xxxx is_private: xxxx tenant_id: xxxx INFO-tenant_name: xxxx partition_id: xxxx INFO-partition_name: xxxx provider_id: xxxx INFO-provider_name: xxxxx consumer_id: xxxx INFO-resp_consumer_name: xxxx other_consumers: INFO-other_consumer_names: vlan_tag: xxxx INFO-vlan_name: description: hashtags: discovery_organization_id: INFO-discovery_organization_name: xxxx discovery_credential_id: INFO-discovery_credential_name: xxxx discovery_scanner_id: INFO-discovery_scanner_name: xxxx discovery_exclude_justification: xxxx INFO-Comments-Notes:
makeeley likes this post
Reply


Messages In This Thread
RE: API Post issue "TypeError: 'str' object is not callable" - by Larz60+ - Oct-29-2022, 08:13 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  TypeError: cannot pickle ‘_asyncio.Future’ object Abdul_Rafey 1 520 Mar-07-2024, 03:40 PM
Last Post: deanhystad
  error in class: TypeError: 'str' object is not callable akbarza 2 606 Dec-30-2023, 04:35 PM
Last Post: deanhystad
Bug TypeError: 'NoneType' object is not subscriptable TheLummen 4 825 Nov-27-2023, 11:34 AM
Last Post: TheLummen
  TypeError: 'NoneType' object is not callable akbarza 4 1,144 Aug-24-2023, 05:14 PM
Last Post: snippsat
  [NEW CODER] TypeError: Object is not callable iwantyoursec 5 1,520 Aug-23-2023, 06:21 PM
Last Post: deanhystad
  Need help with 'str' object is not callable error. Fare 4 908 Jul-23-2023, 02:25 PM
Last Post: Fare
  TypeError: 'float' object is not callable #1 isdito2001 1 1,130 Jan-21-2023, 12:43 AM
Last Post: Yoriz
  TypeError: a bytes-like object is required ZeroX 13 4,504 Jan-07-2023, 07:02 PM
Last Post: deanhystad
  'SSHClient' object is not callable 3lnyn0 1 1,231 Dec-15-2022, 03:40 AM
Last Post: deanhystad
  TypeError: 'float' object is not callable TimofeyKolpakov 3 1,565 Dec-04-2022, 04:58 PM
Last Post: TimofeyKolpakov

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020