p4r4n0y1ng / pyfmg

Represents the base components of the FortiManager JSON-RPC interface

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Free Form Example in README is not accurate

jamesdreid opened this issue · comments

The code sample in the README file used to demonstrate the operation of the free form method does not include a reference the variable defined in the "for" loop in the f-string. The sample code:

multi_data = []
for pol_id in [1, 3, 4, 5, 7]:
    multi_data.append({
            "url": f"/pm/config/adom/root/pkg/default/firewall/policy/",
            "fields": ["policyid", "name"],
          })

if len(multi_data) > 0:
    code, res = fmg_instance.free_form("get", data=multi_data)

Should probably read:

multi_data = []
for pol_id in [1, 3, 4, 5, 7]:
    multi_data.append({
            "url": f"/pm/config/adom/root/pkg/default/firewall/policy/{pol_id}",
            "fields": ["policyid", "name"],
          })

if len(multi_data) > 0:
    code, res = fmg_instance.free_form("get", data=multi_data)

Will be including a fix for this in a PR shortly but it will be submitted with a fix for the other free form response data issue #19

Fix merged in #20