Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSONDecodeError #2

Open
jrogers512 opened this issue Aug 1, 2023 · 2 comments
Open

JSONDecodeError #2

jrogers512 opened this issue Aug 1, 2023 · 2 comments

Comments

@jrogers512
Copy link

Any ideas what may cause this ?

phpIPAM IP address management [v1.4]

jrogers@util01:~/rancid$ python3 -V
Python 3.8.10
jrogers@util01:~/rancid$ pip3 list | grep "ipamcli"
ipamcli                0.0.8
jrogers@util01:~/rancid$ ipamcli search --ip 26.57.79.23
Traceback (most recent call last):
  File "/home/jrogers/.local/bin/ipamcli", line 8, in <module>
    sys.exit(cli())
  File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1134, in invoke
    Command.invoke(self, ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/jrogers/.local/lib/python3.8/site-packages/ipamcli/cli.py", line 82, in cli
    ctx.token = get_token(ctx)
  File "/home/jrogers/.local/lib/python3.8/site-packages/ipamcli/libs/phpipam/client.py", line 79, in get_token
    elif r.status_code == 200 and r.json():
  File "/usr/lib/python3/dist-packages/requests/models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 518, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
@verdel
Copy link
Owner

verdel commented Aug 1, 2023

Unfortunately, I stopped using this tool at my current place of work. Therefore, I stopped keeping it up to date. I will try to make a test stand with the version of phpIPAM you specified in the near future and solve the problem.

@verdel
Copy link
Owner

verdel commented Aug 2, 2023

I create local phpIPAM v1.4.7 deployment
phpIPAM

Enable REST API in the phpIPAM settings and create app with name test
api

After that I remove my work phpIPAM instance-specific code and publish v.0.0.9 of ipamcli.

Environment:

> python -V
Python 3.8.10

> pip -V
pip 23.2.1

> pip show ipamcli
Name: ipamcli
Version: 0.0.9

Here is small test:
asciicast

This utility is rather a small example of how you can work with phpIPAM. I'm afraid that if you want to use it in your work, then you will have to modify it for yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants