
    xh                         d dl Z ddZddZdS )    NFc                     t                      }| D ]}d|i}|                    |           |rt          j        |          S |S )zp decouple, allow for modifications to return type
        returns a list of ip addresses in object or json form ip)listappendjsondumps)
return_setas_jsonret_listitemds        [/var/www/html/what/lib/python3.11/site-packages/sendgrid/helpers/endpoints/ip/unassigned.py
format_retr      sW     vvH  4L $z(###O    c                 
   t                      }t          | t                    st          ||          S | D ]:}t	          |d                   }|dk    r|d         }|                    |           ;t          ||          }|S )a|   https://sendgrid.com/docs/API_Reference/api_v3.html#ip-addresses
        The /ips rest endpoint returns information about the IP addresses
        and the usernames assigned to an IP

        unassigned returns a listing of the IP addresses that are allocated
        but have 0 users assigned


        data (response.body from sg.client.ips.get())
        as_json False -> get list of dicts
                True  -> get json object

        example:
        sg = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))

        params = {
            'subuser': 'test_string',
            'ip': 'test_string',
            'limit': 1,
            'exclude_whitelabels':
            'true', 'offset': 1
        }
        response = sg.client.ips.get(query_params=params)
        if response.status_code == 201:
           data = response.body
           unused = unassigned(data)
    )r
   subusersr   r   )set
isinstancer   r   lenadd)datar
   no_subuserscurrentnum_subusers
current_ipret_vals          r   
unassignedr      s    : %%KdD!! 8+w7777 ( (7:.//1 JOOJ'''g666GNr   )F)r   r   r    r   r   <module>r      s@       ) ) ) ) ) )r   