Skip to content

create_token creates v2 tokens but expects v1 tokens #756

@ddean4040

Description

@ddean4040

pynetbox version

v7.6.1

NetBox version

v4.5.5

Python version

3.10

Steps to Reproduce

import pynetbox

nb = pynetbox.api('https://netbox.example.com')

token = nb.create_token('username', 'password')

https://github.com/netbox-community/pynetbox/blob/v7.6.1/pynetbox/core/api.py#L262

Expected Behavior

Token is created and added to session

e.g.

<pynetbox.core.api.Api object at 0x78d82ebd3b50>
CRu8qzbg9RRc

Observed Behavior

  File "../pynetbox/core/response.py", line 347, in __str__
    getattr(self, "name", None)
  File "../pynetbox/core/response.py", line 323, in __getattr__
    if self.full_details():
  File "../pynetbox/core/response.py", line 527, in full_details
    self._parse_values(next(req.get()))
  File "../pynetbox/core/query.py", line 446, in get
    req = self._make_call(add_params=add_params)
  File "../pynetbox/core/query.py", line 412, in _make_call
    raise RequestError(req)
pynetbox.core.query.RequestError: The request failed with code 403 Forbidden: {'detail': 'Invalid v1 token'}

Metadata

Metadata

Assignees

No one assigned

    Labels

    app: pynetboxseverity: mediumResults in substantial degraded or broken functionality for specfic workflowsstatus: needs ownerThis issue is tentatively accepted pending a volunteer committed to its implementationtype: bugA confirmed report of unexpected behavior in the application

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions