Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-pynetbox for openSUSE:Factory 
checked in at 2023-01-24 19:43:33
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pynetbox (Old)
 and      /work/SRC/openSUSE:Factory/.python-pynetbox.new.32243 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pynetbox"

Tue Jan 24 19:43:33 2023 rev:33 rq:1060579 version:7.0.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pynetbox/python-pynetbox.changes  
2022-12-13 18:55:40.831271536 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-pynetbox.new.32243/python-pynetbox.changes   
    2023-01-24 20:32:54.936560332 +0100
@@ -1,0 +2,7 @@
+Mon Jan 23 21:56:39 UTC 2023 - Martin Hauke <mar...@gmx.de>
+
+- Update to version 7.0.1
+  * Removed pre-NetBox 3.3 features.
+  * Fix custom_filed KeyError traceback.
+
+-------------------------------------------------------------------

Old:
----
  pynetbox-7.0.0.tar.gz

New:
----
  pynetbox-7.0.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-pynetbox.spec ++++++
--- /var/tmp/diff_new_pack.lXwTZE/_old  2023-01-24 20:32:55.464563127 +0100
+++ /var/tmp/diff_new_pack.lXwTZE/_new  2023-01-24 20:32:55.464563127 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-pynetbox
 #
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -16,10 +16,9 @@
 #
 
 
-%{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %define         skip_python2 1
 Name:           python-pynetbox
-Version:        7.0.0
+Version:        7.0.1
 Release:        0
 Summary:        NetBox API client library
 License:        Apache-2.0
@@ -60,6 +59,6 @@
 %files %{python_files}
 %doc README.md CHANGELOG.md
 %license LICENSE
-%{python_sitelib}/*
+%{python_sitelib}/pynetbox*
 
 %changelog

++++++ pynetbox-7.0.0.tar.gz -> pynetbox-7.0.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-7.0.0/PKG-INFO new/pynetbox-7.0.1/PKG-INFO
--- old/pynetbox-7.0.0/PKG-INFO 2022-12-09 18:53:33.226451000 +0100
+++ new/pynetbox-7.0.1/PKG-INFO 2023-01-23 21:39:05.135211500 +0100
@@ -1,8 +1,8 @@
 Metadata-Version: 2.1
 Name: pynetbox
-Version: 7.0.0
+Version: 7.0.1
 Summary: NetBox API client library
-Home-page: https://github.com/netbox-community/netbox
+Home-page: https://github.com/netbox-community/pynetbox
 Author: Zach Moody
 Author-email: zmo...@do.co
 License: Apache2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-7.0.0/README.md new/pynetbox-7.0.1/README.md
--- old/pynetbox-7.0.0/README.md        2022-12-09 18:53:22.000000000 +0100
+++ new/pynetbox-7.0.1/README.md        2023-01-23 21:38:54.000000000 +0100
@@ -20,12 +20,11 @@
 import pynetbox
 nb = pynetbox.api(
     'http://localhost:8000',
-    private_key_file='/path/to/private-key.pem',
     token='d6f4e314a5b5fefd164995169f28ae32d987704f'
 )
 ```
 
-The first argument the .api() method takes is the NetBox URL. There are a 
handful of named arguments you can provide, but in most cases none are required 
to simply pull data. In order to write, the `token` argument should to be 
provided. To decrypt information from the `secrets` endpoint either the 
`private_key_file` or `private_key` argument needs to be provided.
+The first argument the .api() method takes is the NetBox URL. There are a 
handful of named arguments you can provide, but in most cases none are required 
to simply pull data. In order to write, the `token` argument should to be 
provided.
 
 
 ## Queries
@@ -43,6 +42,11 @@
 >>>
 ```
 
+Note that the all() and filter() methods are generators and return an object 
that can be iterated over only once.  If you are going to be iterating over it 
repeatedly you need to either call the all() method again, or encapsulate the 
results in a `list` object like this:
+```
+>>> devices = list(nb.dcim.devices.all())
+```
+
 ### Threading
 
 pynetbox supports multithreaded calls for `.filter()` and `.all()` queries. It 
is **highly recommended** you have `MAX_PAGE_SIZE` in your Netbox install set 
to anything *except* `0` or `None`. The default value of `1000` is usually a 
good value to use. To enable threading, add `threading=True` parameter to the 
`.api`:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-7.0.0/docs/advanced.rst 
new/pynetbox-7.0.1/docs/advanced.rst
--- old/pynetbox-7.0.0/docs/advanced.rst        2022-12-09 18:53:22.000000000 
+0100
+++ new/pynetbox-7.0.1/docs/advanced.rst        2023-01-23 21:38:54.000000000 
+0100
@@ -16,7 +16,6 @@
 >>> session.headers = {"mycustomheader": "test"}
 >>> nb = pynetbox.api(
 ...     'http://localhost:8000',
-...     private_key_file='/path/to/private-key.pem',
 ...     token='d6f4e314a5b5fefd164995169f28ae32d987704f'
 ... )
 >>> nb.http_session = session
@@ -35,7 +34,6 @@
 >>> session.verify = False
 >>> nb = pynetbox.api(
 ...     'http://localhost:8000',
-...     private_key_file='/path/to/private-key.pem',
 ...     token='d6f4e314a5b5fefd164995169f28ae32d987704f'
 ... )
 >>> nb.http_session = session
@@ -68,7 +66,6 @@
 
     nb = pynetbox.api(
         'http://localhost:8000',
-        private_key_file='/path/to/private-key.pem',
         token='d6f4e314a5b5fefd164995169f28ae32d987704f'
     )
     nb.http_session = session
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-7.0.0/pynetbox/core/api.py 
new/pynetbox-7.0.1/pynetbox/core/api.py
--- old/pynetbox-7.0.0/pynetbox/core/api.py     2022-12-09 18:53:22.000000000 
+0100
+++ new/pynetbox-7.0.1/pynetbox/core/api.py     2023-01-23 21:38:54.000000000 
+0100
@@ -30,12 +30,11 @@
         * dcim
         * ipam
         * circuits
-        * secrets (on NetBox 2.11 and older)
         * tenancy
         * extras
         * virtualization
-        * users (since NetBox 2.9)
-        * wireless (since NetBox 3.1)
+        * users
+        * wireless
 
     Calling any of these attributes will return
     :py:class:`.App` which exposes endpoints as attributes.
@@ -50,13 +49,8 @@
     :param str url: The base URL to the instance of NetBox you
         wish to connect to.
     :param str token: Your NetBox token.
-    :param str,optional private_key_file: The path to your private
-        key file. (Usable only on NetBox 2.11 and older)
-    :param str,optional private_key: Your private key. (Usable only on NetBox 
2.11 and older)
     :param bool,optional threading: Set to True to use threading in ``.all()``
         and ``.filter()`` requests.
-    :raises ValueError: If *private_key* and *private_key_file* are both
-        specified.
     :raises AttributeError: If app doesn't exist.
     :Examples:
 
@@ -73,32 +67,16 @@
         self,
         url,
         token=None,
-        private_key=None,
-        private_key_file=None,
         threading=False,
     ):
-        if private_key and private_key_file:
-            raise ValueError(
-                '"private_key" and "private_key_file" cannot be used together.'
-            )
         base_url = "{}/api".format(url if url[-1] != "/" else url[:-1])
         self.token = token
-        self.private_key = private_key
-        self.private_key_file = private_key_file
         self.base_url = base_url
-        self.session_key = None
         self.http_session = requests.Session()
         self.threading = threading
-
-        if self.private_key_file:
-            with open(self.private_key_file, "r") as kf:
-                private_key = kf.read()
-                self.private_key = private_key
-
         self.dcim = App(self, "dcim")
         self.ipam = App(self, "ipam")
         self.circuits = App(self, "circuits")
-        self.secrets = App(self, "secrets")
         self.tenancy = App(self, "tenancy")
         self.extras = App(self, "extras")
         self.virtualization = App(self, "virtualization")
@@ -156,8 +134,6 @@
     def status(self):
         """Gets the status information from NetBox.
 
-        Available in NetBox 2.10.0 or newer.
-
         :Returns: Dictionary as returned by NetBox.
         :Raises: :py:class:`.RequestError` if the request is not successful.
         :Example:
@@ -192,8 +168,6 @@
         """Creates an API token using a valid NetBox username and password.
         Saves the created token automatically in the API object.
 
-        Requires NetBox 3.0.0 or newer.
-
         :Returns: The token as a ``Record`` object.
         :Raises: :py:class:`.RequestError` if the request is not successful.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-7.0.0/pynetbox/core/app.py 
new/pynetbox-7.0.1/pynetbox/core/app.py
--- old/pynetbox-7.0.0/pynetbox/core/app.py     2022-12-09 18:53:22.000000000 
+0100
+++ new/pynetbox-7.0.1/pynetbox/core/app.py     2023-01-23 21:38:54.000000000 
+0100
@@ -39,7 +39,6 @@
     def __init__(self, api, name):
         self.api = api
         self.name = name
-        self._choices = None
         self._setmodel()
 
     models = {
@@ -56,79 +55,15 @@
         self.model = App.models[self.name] if self.name in App.models else None
 
     def __getstate__(self):
-        return {"api": self.api, "name": self.name, "_choices": self._choices}
+        return {"api": self.api, "name": self.name}
 
     def __setstate__(self, d):
         self.__dict__.update(d)
         self._setmodel()
 
     def __getattr__(self, name):
-        if name == "secrets":
-            self._set_session_key()
         return Endpoint(self.api, self, name, model=self.model)
 
-    def _set_session_key(self):
-        if getattr(self.api, "session_key"):
-            return
-        if self.api.token and self.api.private_key:
-            self.api.session_key = Request(
-                base=self.api.base_url,
-                token=self.api.token,
-                private_key=self.api.private_key,
-                http_session=self.api.http_session,
-            ).get_session_key()
-
-    def choices(self):
-        """Returns _choices response from App
-
-        .. note::
-
-            This method is deprecated and only works with NetBox version 2.7.x
-            or older. The ``choices()`` method in :py:class:`.Endpoint` is
-            compatible with all NetBox versions.
-
-        :Returns: Raw response from NetBox's _choices endpoint.
-        """
-        if self._choices:
-            return self._choices
-
-        self._choices = Request(
-            base="{}/{}/_choices/".format(self.api.base_url, self.name),
-            token=self.api.token,
-            private_key=self.api.private_key,
-            http_session=self.api.http_session,
-        ).get()
-
-        return self._choices
-
-    def custom_choices(self):
-        """Returns _custom_field_choices response from app
-
-        .. note::
-
-            This method only works with NetBox version 2.9.x or older. NetBox
-            2.10.0 introduced the ``/extras/custom-fields/`` endpoint that can
-            be used f.ex. like ``nb.extras.custom_fields.all()``.
-
-        :Returns: Raw response from NetBox's _custom_field_choices endpoint.
-        :Raises: :py:class:`.RequestError` if called for an invalid endpoint.
-        :Example:
-
-        >>> nb.extras.custom_choices()
-        {'Testfield1': {'Testvalue2': 2, 'Testvalue1': 1},
-         'Testfield2': {'Othervalue2': 4, 'Othervalue1': 3}}
-        """
-        custom_field_choices = Request(
-            base="{}/{}/_custom_field_choices/".format(
-                self.api.base_url,
-                self.name,
-            ),
-            token=self.api.token,
-            private_key=self.api.private_key,
-            http_session=self.api.http_session,
-        ).get()
-        return custom_field_choices
-
     def config(self):
         """Returns config response from app
 
@@ -151,7 +86,6 @@
                 self.name,
             ),
             token=self.api.token,
-            private_key=self.api.private_key,
             http_session=self.api.http_session,
         ).get()
         return config
@@ -198,7 +132,6 @@
                 self.api.base_url,
             ),
             token=self.api.token,
-            private_key=self.api.private_key,
             http_session=self.api.http_session,
         ).get()
         return installed_plugins
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-7.0.0/pynetbox/core/endpoint.py 
new/pynetbox-7.0.1/pynetbox/core/endpoint.py
--- old/pynetbox-7.0.0/pynetbox/core/endpoint.py        2022-12-09 
18:53:22.000000000 +0100
+++ new/pynetbox-7.0.1/pynetbox/core/endpoint.py        2023-01-23 
21:38:54.000000000 +0100
@@ -46,7 +46,6 @@
         self.api = api
         self.base_url = api.base_url
         self.token = api.token
-        self.session_key = api.session_key
         self.url = "{base_url}/{app}/{endpoint}".format(
             base_url=self.base_url,
             app=app.name,
@@ -79,14 +78,16 @@
         Returns all objects from an endpoint.
 
         :arg int,optional limit: Overrides the max page size on
-            paginated returns.
+            paginated returns.  This defines the number of records that will
+            be returned with each query to the Netbox server.  The queries
+            will be made as you iterate through the result set.
         :arg int,optional offset: Overrides the offset on paginated returns.
 
         :Returns: A :py:class:`.RecordSet` object.
 
         :Examples:
 
-        >>> devices = nb.dcim.devices.all()
+        >>> devices = list(nb.dcim.devices.all())
         >>> for device in devices:
         ...     print(device.name)
         ...
@@ -94,13 +95,20 @@
         test1-leaf2
         test1-leaf3
         >>>
+
+        If you want to iterate over the results multiple times then
+        encapsulate them in a list like this:
+        >>> devices = list(nb.dcim.devices.all())
+
+        This will cause the entire result set
+        to be fetched from the server.
+
         """
         if limit == 0 and offset is not None:
             raise ValueError("offset requires a positive limit value")
         req = Request(
             base="{}/".format(self.url),
             token=self.token,
-            session_key=self.session_key,
             http_session=self.api.http_session,
             threading=self.api.threading,
             limit=limit,
@@ -136,6 +144,11 @@
         >>> nb.dcim.devices.get(1)
         test1-edge1
         >>>
+
+        Using multiple named arguments. For example, retriving the location 
when the location name is not unique and used in multiple sites.
+
+        >>> nb.locations.get(site='site-1', name='Row 1')
+        Row 1
         """
 
         try:
@@ -162,7 +175,6 @@
             key=key,
             base=self.url,
             token=self.token,
-            session_key=self.session_key,
             http_session=self.api.http_session,
         )
         try:
@@ -185,7 +197,9 @@
         :arg str,optional \**kwargs: Any search argument the
             endpoint accepts can be added as a keyword arg.
         :arg int,optional limit: Overrides the max page size on
-            paginated returns.
+            paginated returns.  This defines the number of records that will
+            be returned with each query to the Netbox server.  The queries
+            will be made as you iterate through the result set.
         :arg int,optional offset: Overrides the offset on paginated returns.
 
         :Returns: A :py:class:`.RecordSet` object.
@@ -203,6 +217,23 @@
         test1-leaf3
         >>>
 
+        >>> devices = nb.dcim.devices.filter(site='site-1')
+        >>> for device in devices:
+        ...     print(device.name)
+        ...
+        test1-a2-leaf1
+        test2-a2-leaf2
+        >>>
+
+        If we want to filter by site, location, tenant, or fields which have a 
display name and a slug, the slug has to be used for filtering.
+
+        .. note::
+
+          If a keyword argument is incorrect a `TypeError` will not be 
returned by pynetbox.
+          Instead, all records filtered up to the last correct keyword 
argument. For example, if we used `site="Site 1"` instead of `site=site-1` when 
using filter on
+          the devices endpoint, then pynetbox will return **all** devices 
across all sites instead of devices at Site 1.
+
+
         Using a freeform query along with a named argument.
 
         >>> devices = nb.dcim.devices.filter('a3', role='leaf-switch')
@@ -213,6 +244,7 @@
         test1-a3-leaf2
         >>>
 
+
         Chaining multiple named arguments.
 
         >>> devices = nb.dcim.devices.filter(role='leaf-switch', status=True)
@@ -233,6 +265,12 @@
         test1-a3-spine2
         test1-a3-leaf1
         >>>
+
+        To have the ability to iterate over the results multiple times then
+        encapsulate them in a list.  This will cause the entire result set
+        to be fetched from the server.
+
+        >>> devices = list(nb.dcim.devices.filter(role='leaf-switch'))
         """
 
         if args:
@@ -251,7 +289,6 @@
             filters=kwargs,
             base=self.url,
             token=self.token,
-            session_key=self.session_key,
             http_session=self.api.http_session,
             threading=self.api.threading,
             limit=limit,
@@ -290,6 +327,18 @@
         ... )
         >>>
 
+        Creating an object on the 'devices' endpoint using `.get()` to get ids.
+
+        >>> device = netbox.dcim.devices.create(
+        ...     name = 'test1',
+        ...     site = netbox.dcim.devices.get(name='site1').id,
+        ...     location = netbox.dcim.locations.get(name='Row 1').id,
+        ...     rack = netbox.dcim.racks.get(facility_id=1).id,
+        ...     device_type = 
netbox.dcim.device_types.get(slug='server-type-1').id,
+        ...     status='active',
+        ...     )
+        >>>
+
         Use bulk creation by passing a list of dictionaries:
 
         >>> nb.dcim.devices.create([
@@ -308,12 +357,60 @@
         ...         "status": 1
         ...     }
         ... ])
+
+        Create a new device type.
+
+        >>> device_type = netbox.dcim.devices.create(
+        ...     manufacturer = 
netbox.dcim.manufacturers.get(name='manufacturer-name').id,
+        ...     model = 'device-type-name',
+        ...     slug = 'device-type-slug',
+        ...     subdevice_role = 'child or parent', #optional field - requred 
if creating a device type to be used by child devices
+        ...     u_height = unit_height, #can only equal 0 if the device type 
is for a child device - requires subdevice_role='child' if that is the case
+        ...     custom_fields = {'cf_1' : 'custom data 1'}
+        ...     )
+
+        Create a device bay and child device.
+
+        >>> device_bay = netbox.dcim.device_bays.create(
+        ...     device = netbox.dcim.devices.get(name='parent device').id, # 
device the device bay is located
+        ...     name = 'Bay 1'
+        ...     )
+        >>> child_device = netbox.dcim.devices.create(
+        ...     name = 'child device',
+        ...     site = netbox.dcim.devices.get(name='test-site').id,
+        ...     location = netbox.dcim.locations.get(name='row-1').id,
+        ...     tenant = netbox.tenancy.tenants.get(name='tenant-1').id,
+        ...     manufactuer = netbox.dcim.manufacturers.get(name='test-m').id,
+        ...     rack = netbox.dcim.racks.get(name='Test Rack').id,
+        ...     device_type = 
netbox.dcim.device.types.get(slug='test-server').id, #easier to get device_type 
id by search by its slug rather than by its name
+        ...     )
+        >>> get_device_bay = netbox.dcim.device_bays.get(name='Bay 1')
+        >>> get_child_device = netbox.dcim.devices.get(name='child device')
+        >>> get_device_bay.installed_device = get_child_device
+        >>> get_device_bay.save()
+
+        Create a network interface
+
+        >>> interface = netbox.dcim.interfaces.get(name="interface-test", 
device="test-device")
+        >>> netbox_ip = netbox.ipam.ip_addresses.create(
+        ... address = "ip-address",
+        ... tenant = netbox.tenancy.tenants.get(name='tenant-1').id,
+        ... tags = [{'name':'Tag 1'}],
+        ... )
+        >>> #assign IP Address to device's network interface
+        >>> netbox_ip.assigned_object = interface
+        >>> netbox_ip.assigned_object_id = interface.id
+        >>> netbox_ip.assigned_object_type = 'dcim.interface'
+        >>> # add dns name to IP Address (optional)
+        >>> netbox_ip.dns_name = "test.dns.local"
+        >>> # save changes to IP Address
+        >>> netbox_ip.save()
+
         """
 
         req = Request(
             base=self.url,
             token=self.token,
-            session_key=self.session_key,
             http_session=self.api.http_session,
         ).post(args[0] if args else kwargs)
 
@@ -380,7 +477,6 @@
         req = Request(
             base=self.url,
             token=self.token,
-            session_key=self.session_key,
             http_session=self.api.http_session,
         ).patch(series)
 
@@ -445,7 +541,6 @@
         req = Request(
             base=self.url,
             token=self.token,
-            session_key=self.session_key,
             http_session=self.api.http_session,
         )
         return True if req.delete(data=[{"id": i} for i in cleaned_ids]) else 
False
@@ -461,7 +556,7 @@
 
         :Returns: Dict containing the available choices.
 
-        :Example (from NetBox 2.8.x):
+        :Example:
 
         >>> from pprint import pprint
         >>> pprint(nb.ipam.ip_addresses.choices())
@@ -476,7 +571,8 @@
          'status': [{'display_name': 'Active', 'value': 'active'},
                     {'display_name': 'Reserved', 'value': 'reserved'},
                     {'display_name': 'Deprecated', 'value': 'deprecated'},
-                    {'display_name': 'DHCP', 'value': 'dhcp'}]}
+                    {'display_name': 'DHCP', 'value': 'dhcp'},
+                    {'display_name': 'SLAAC', 'value': 'slaac'}]}
         >>>
         """
         if self._choices:
@@ -485,7 +581,6 @@
         req = Request(
             base=self.url,
             token=self.api.token,
-            private_key=self.api.private_key,
             http_session=self.api.http_session,
         ).options()
         try:
@@ -545,7 +640,6 @@
             filters=kwargs,
             base=self.url,
             token=self.token,
-            session_key=self.session_key,
             http_session=self.api.http_session,
         )
 
@@ -566,7 +660,6 @@
         self.request_kwargs = dict(
             base=self.url,
             token=parent_obj.api.token,
-            session_key=parent_obj.api.session_key,
             http_session=parent_obj.api.http_session,
         )
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-7.0.0/pynetbox/core/query.py 
new/pynetbox-7.0.1/pynetbox/core/query.py
--- old/pynetbox-7.0.0/pynetbox/core/query.py   2022-12-09 18:53:22.000000000 
+0100
+++ new/pynetbox-7.0.1/pynetbox/core/query.py   2023-01-23 21:38:54.000000000 
+0100
@@ -15,7 +15,6 @@
 """
 import concurrent.futures as cf
 import json
-from urllib.parse import urlencode
 
 
 def calc_pages(limit, count):
@@ -71,8 +70,7 @@
     """Allocation Exception
 
     Used with available-ips/available-prefixes when there is no
-    room for allocation and NetBox returns 204 No Content (before
-    NetBox 3.1.1) or 409 Conflict (since NetBox 3.1.1+).
+    room for allocation and NetBox returns 409 Conflict.
     """
 
     def __init__(self, req):
@@ -118,8 +116,6 @@
         correlate to the filters a given endpoint accepts.
         In (e.g. /api/dcim/devices/?name='test') 'name': 'test'
         would be in the filters dict.
-    :param private_key: (str, optional) The user's private key as a
-        string.
     """
 
     def __init__(
@@ -131,8 +127,6 @@
         offset=None,
         key=None,
         token=None,
-        private_key=None,
-        session_key=None,
         threading=False,
     ):
         """
@@ -145,15 +139,11 @@
                 In (e.g. /api/dcim/devices/?name='test') 'name': 'test'
                 would be in the filters dict.
             key (int, optional): database id of the item being queried.
-            private_key (string, optional): The user's private key as a
-                string.
         """
         self.base = self.normalize_url(base)
         self.filters = filters or None
         self.key = key
         self.token = token
-        self.private_key = private_key
-        self.session_key = session_key
         self.http_session = http_session
         self.url = self.base if not key else "{}{}/".format(self.base, key)
         self.threading = threading
@@ -196,31 +186,6 @@
         else:
             raise RequestError(req)
 
-    def get_session_key(self):
-        """Requests session key
-
-        Issues a GET request to the `get-session-key` endpoint for
-        subsequent use in requests from the `secrets` endpoint.
-
-        :Returns: String containing session key.
-        """
-        req = self.http_session.post(
-            "{}secrets/get-session-key/?preserve_key=True".format(self.base),
-            headers={
-                "accept": "application/json",
-                "authorization": "Token {}".format(self.token),
-                "Content-Type": "application/x-www-form-urlencoded",
-            },
-            data=urlencode({"private_key": self.private_key.strip("\n")}),
-        )
-        if req.ok:
-            try:
-                return req.json()["session_key"]
-            except json.JSONDecodeError:
-                raise ContentError(req)
-        else:
-            raise RequestError(req)
-
     def get_status(self):
         """Gets the status from /api/status/ endpoint in NetBox.
 
@@ -254,8 +219,6 @@
 
         if self.token:
             headers["authorization"] = "Token {}".format(self.token)
-        if self.session_key:
-            headers["X-Session-Key"] = self.session_key
 
         params = {}
         if not url_override:
@@ -268,7 +231,7 @@
             url_override or self.url, headers=headers, params=params, json=data
         )
 
-        if req.status_code in [204, 409] and verb == "post":
+        if req.status_code == 409 and verb == "post":
             raise AllocationError(req)
         if verb == "delete":
             if req.ok:
@@ -367,8 +330,7 @@
     def put(self, data):
         """Makes PUT request.
 
-        Makes a PUT request to NetBox's API. Adds the session key to
-        headers if the `private_key` attribute was populated.
+        Makes a PUT request to NetBox's API.
 
         :param data: (dict) Contains a dict that will be turned into a
             json object and sent to the API.
@@ -381,13 +343,12 @@
     def post(self, data):
         """Makes POST request.
 
-        Makes a POST request to NetBox's API. Adds the session key to
-        headers if the `private_key` attribute was populated.
+        Makes a POST request to NetBox's API.
 
         :param data: (dict) Contains a dict that will be turned into a
             json object and sent to the API.
         :raises: RequestError if req.ok returns false.
-        :raises: AllocationError if req.status_code is 204 (No Content)
+        :raises: AllocationError if req.status_code is 409 (Conflict)
             as with available-ips and available-prefixes when there is
             no room for the requested allocation.
         :raises: ContentError if response is not json.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-7.0.0/pynetbox/core/response.py 
new/pynetbox-7.0.1/pynetbox/core/response.py
--- old/pynetbox-7.0.0/pynetbox/core/response.py        2022-12-09 
18:53:22.000000000 +0100
+++ new/pynetbox-7.0.1/pynetbox/core/response.py        2023-01-23 
21:38:54.000000000 +0100
@@ -58,9 +58,19 @@
 
 
 def flatten_custom(custom_dict):
-    return {
-        k: v if not isinstance(v, dict) else v["value"] for k, v in 
custom_dict.items()
-    }
+    ret = {}
+
+    for k, val in custom_dict.items():
+        current_val = val
+
+        if isinstance(val, dict):
+            current_val = val.get("id", val)
+
+        if isinstance(val, list):
+            current_val = [v.get("id") if isinstance(v, dict) else v for v in 
val]
+
+        ret[k] = current_val
+    return ret
 
 
 class JsonField:
@@ -441,7 +451,6 @@
             req = Request(
                 base=self.url,
                 token=self.api.token,
-                session_key=self.api.session_key,
                 http_session=self.api.http_session,
             )
             self._parse_values(next(req.get()))
@@ -554,7 +563,6 @@
                 key=self.id,
                 base=self.endpoint.url,
                 token=self.api.token,
-                session_key=self.api.session_key,
                 http_session=self.api.http_session,
             )
             if req.patch(updates):
@@ -601,7 +609,6 @@
             key=self.id,
             base=self.endpoint.url,
             token=self.api.token,
-            session_key=self.api.session_key,
             http_session=self.api.http_session,
         )
         return True if req.delete() else False
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-7.0.0/pynetbox/models/dcim.py 
new/pynetbox-7.0.1/pynetbox/models/dcim.py
--- old/pynetbox-7.0.0/pynetbox/models/dcim.py  2022-12-09 18:53:22.000000000 
+0100
+++ new/pynetbox-7.0.1/pynetbox/models/dcim.py  2023-01-23 21:38:54.000000000 
+0100
@@ -57,7 +57,6 @@
             key=str(self.id) + "/trace",
             base=self.endpoint.url,
             token=self.api.token,
-            session_key=self.api.session_key,
             http_session=self.api.http_session,
         ).get()
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-7.0.0/pynetbox/models/ipam.py 
new/pynetbox-7.0.1/pynetbox/models/ipam.py
--- old/pynetbox-7.0.0/pynetbox/models/ipam.py  2022-12-09 18:53:22.000000000 
+0100
+++ new/pynetbox-7.0.1/pynetbox/models/ipam.py  2023-01-23 21:38:54.000000000 
+0100
@@ -148,8 +148,6 @@
         Returns a DetailEndpoint object that is the interface for
         viewing and creating VLANs inside a VLAN group.
 
-        Available since NetBox 3.2.0.
-
         :returns: :py:class:`.DetailEndpoint`
 
         :Examples:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-7.0.0/pynetbox.egg-info/PKG-INFO 
new/pynetbox-7.0.1/pynetbox.egg-info/PKG-INFO
--- old/pynetbox-7.0.0/pynetbox.egg-info/PKG-INFO       2022-12-09 
18:53:33.000000000 +0100
+++ new/pynetbox-7.0.1/pynetbox.egg-info/PKG-INFO       2023-01-23 
21:39:05.000000000 +0100
@@ -1,8 +1,8 @@
 Metadata-Version: 2.1
 Name: pynetbox
-Version: 7.0.0
+Version: 7.0.1
 Summary: NetBox API client library
-Home-page: https://github.com/netbox-community/netbox
+Home-page: https://github.com/netbox-community/pynetbox
 Author: Zach Moody
 Author-email: zmo...@do.co
 License: Apache2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-7.0.0/pynetbox.egg-info/SOURCES.txt 
new/pynetbox-7.0.1/pynetbox.egg-info/SOURCES.txt
--- old/pynetbox-7.0.0/pynetbox.egg-info/SOURCES.txt    2022-12-09 
18:53:33.000000000 +0100
+++ new/pynetbox-7.0.1/pynetbox.egg-info/SOURCES.txt    2023-01-23 
21:39:05.000000000 +0100
@@ -48,7 +48,6 @@
 tests/test_virtualization.py
 tests/test_wireless.py
 tests/util.py
-tests/fixtures/api/get_session_key.json
 tests/fixtures/api/token_provision.json
 tests/fixtures/circuits/circuit.json
 tests/fixtures/circuits/circuit_termination.json
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-7.0.0/setup.py new/pynetbox-7.0.1/setup.py
--- old/pynetbox-7.0.0/setup.py 2022-12-09 18:53:22.000000000 +0100
+++ new/pynetbox-7.0.1/setup.py 2023-01-23 21:38:54.000000000 +0100
@@ -3,7 +3,7 @@
 setup(
     name="pynetbox",
     description="NetBox API client library",
-    url="https://github.com/netbox-community/netbox";,
+    url="https://github.com/netbox-community/pynetbox";,
     author="Zach Moody",
     author_email="zmo...@do.co",
     license="Apache2",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/pynetbox-7.0.0/tests/fixtures/api/get_session_key.json 
new/pynetbox-7.0.1/tests/fixtures/api/get_session_key.json
--- old/pynetbox-7.0.0/tests/fixtures/api/get_session_key.json  2022-12-09 
18:53:22.000000000 +0100
+++ new/pynetbox-7.0.1/tests/fixtures/api/get_session_key.json  1970-01-01 
01:00:00.000000000 +0100
@@ -1,3 +0,0 @@
-{
-    "session_key": "ansodicnaoiwenafoi="
-}
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-7.0.0/tests/integration/conftest.py 
new/pynetbox-7.0.1/tests/integration/conftest.py
--- old/pynetbox-7.0.0/tests/integration/conftest.py    2022-12-09 
18:53:22.000000000 +0100
+++ new/pynetbox-7.0.1/tests/integration/conftest.py    2023-01-23 
21:38:54.000000000 +0100
@@ -1,6 +1,5 @@
 import os
 
-from packaging import version
 import subprocess as subp
 import time
 import yaml
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-7.0.0/tests/test_api.py 
new/pynetbox-7.0.1/tests/test_api.py
--- old/pynetbox-7.0.0/tests/test_api.py        2022-12-09 18:53:22.000000000 
+0100
+++ new/pynetbox-7.0.1/tests/test_api.py        2023-01-23 21:38:54.000000000 
+0100
@@ -9,7 +9,6 @@
 
 def_kwargs = {
     "token": "abc123",
-    "private_key_file": "tests/fixtures/api/get_session_key.json",
 }
 
 # Keys are app names, values are arbitrarily selected endpoints
@@ -26,7 +25,7 @@
 class ApiTestCase(unittest.TestCase):
     @patch(
         "requests.sessions.Session.post",
-        return_value=Response(fixture="api/get_session_key.json"),
+        return_value=Response(),
     )
     def test_get(self, *_):
         api = pynetbox.api(host, **def_kwargs)
@@ -34,7 +33,7 @@
 
     @patch(
         "requests.sessions.Session.post",
-        return_value=Response(fixture="api/get_session_key.json"),
+        return_value=Response(),
     )
     def test_sanitize_url(self, *_):
         api = pynetbox.api("http://localhost:8000/";, **def_kwargs)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-7.0.0/tests/test_app.py 
new/pynetbox-7.0.1/tests/test_app.py
--- old/pynetbox-7.0.0/tests/test_app.py        2022-12-09 18:53:22.000000000 
+0100
+++ new/pynetbox-7.0.1/tests/test_app.py        2023-01-23 21:38:54.000000000 
+0100
@@ -11,21 +11,6 @@
 }
 
 
-class AppCustomChoicesTestCase(unittest.TestCase):
-    @patch(
-        "pynetbox.core.query.Request.get",
-        return_value={
-            "Testfield1": {"TF1_1": 1, "TF1_2": 2},
-            "Testfield2": {"TF2_1": 3, "TF2_2": 4},
-        },
-    )
-    def test_custom_choices(self, *_):
-        api = pynetbox.api(host, **def_kwargs)
-        choices = api.extras.custom_choices()
-        self.assertEqual(len(choices), 2)
-        self.assertEqual(sorted(choices.keys()), ["Testfield1", "Testfield2"])
-
-
 class AppConfigTestCase(unittest.TestCase):
     @patch(
         "pynetbox.core.query.Request.get",
@@ -52,20 +37,7 @@
         )
 
 
-class PluginAppCustomChoicesTestCase(unittest.TestCase):
-    @patch(
-        "pynetbox.core.query.Request.get",
-        return_value={
-            "Testfield1": {"TF1_1": 1, "TF1_2": 2},
-            "Testfield2": {"TF2_1": 3, "TF2_2": 4},
-        },
-    )
-    def test_custom_choices(self, *_):
-        api = pynetbox.api(host, **def_kwargs)
-        choices = api.plugins.test_plugin.custom_choices()
-        self.assertEqual(len(choices), 2)
-        self.assertEqual(sorted(choices.keys()), ["Testfield1", "Testfield2"])
-
+class PluginAppTestCase(unittest.TestCase):
     @patch(
         "pynetbox.core.query.Request.get",
         return_value=[
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-7.0.0/tests/unit/test_response.py 
new/pynetbox-7.0.1/tests/unit/test_response.py
--- old/pynetbox-7.0.0/tests/unit/test_response.py      2022-12-09 
18:53:22.000000000 +0100
+++ new/pynetbox-7.0.1/tests/unit/test_response.py      2023-01-23 
21:38:54.000000000 +0100
@@ -162,32 +162,7 @@
         test = Record(test_values, None, None)
         self.assertEqual(dict(test), test_values)
 
-    def test_choices_idempotence_prev27(self):
-        test_values = {
-            "id": 123,
-            "choices_test": {
-                "value": 1,
-                "label": "test",
-            },
-        }
-        test = Record(test_values, None, None)
-        test.choices_test = 1
-        self.assertFalse(test._diff())
-
-    def test_choices_idempotence_v27(self):
-        test_values = {
-            "id": 123,
-            "choices_test": {
-                "value": "test",
-                "label": "test",
-                "id": 1,
-            },
-        }
-        test = Record(test_values, None, None)
-        test.choices_test = "test"
-        self.assertFalse(test._diff())
-
-    def test_choices_idempotence_v28(self):
+    def test_choices_idempotence(self):
         test_values = {
             "id": 123,
             "choices_test": {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-7.0.0/tests/util.py 
new/pynetbox-7.0.1/tests/util.py
--- old/pynetbox-7.0.0/tests/util.py    2022-12-09 18:53:22.000000000 +0100
+++ new/pynetbox-7.0.1/tests/util.py    2023-01-23 21:38:54.000000000 +0100
@@ -8,6 +8,8 @@
         self.ok = ok
 
     def load_fixture(self, path):
+        if not path:
+            return "{}"
         with open("tests/fixtures/{}".format(path), "r") as f:
             return f.read()
 

Reply via email to