You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ python3
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
>>> import gns3fy
>>> gns3_server = gns3fy.Gns3Connector("http://127.0.0.1:3080")
>>> lab = gns3fy.Project(name="API_TEST", connector=gns3_server)
>>> lab.get()
Traceback (most recent call last):
File "/home/sever/scripts/python/gns3fy/.venv/lib/python3.10/site-packages/requests/models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/sever/scripts/python/gns3fy/.venv/lib/python3.10/site-packages/gns3fy/gns3fy.py", line 1216, in get
_response = self.connector.http_call("get", _url)
File "/home/sever/scripts/python/gns3fy/.venv/lib/python3.10/site-packages/gns3fy/gns3fy.py", line 144, in http_call
f"{_response.json()['status']}: {_response.json()['message']}"
File "/home/sever/scripts/python/gns3fy/.venv/lib/python3.10/site-packages/requests/models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
>>> history
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'history' is not defined
>>>
Another try:
>>> import gns3fy
>>> from tabulate import tabulate
>>>
>>> gns3_server = gns3fy.Gns3Connector("http://<server address>:3080")
>>>
>>> gns3_server = gns3fy.Gns3Connector("http://127.0.0.1:3080")
>>>
>>> print(
tabulate(
gns3_server.projects_summary(is_print=False),
headers=["Project Name", "Project ID", "Total Nodes", "Total Links", "Status"],
)
)
Traceback (most recent call last):
File "/home/sever/scripts/python/gns3fy/.venv/lib/python3.10/site-packages/requests/models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
File "/home/sever/scripts/python/gns3fy/.venv/lib/python3.10/site-packages/gns3fy/gns3fy.py", line 163, in projects_summary
for _p in self.get_projects():
File "/home/sever/scripts/python/gns3fy/.venv/lib/python3.10/site-packages/gns3fy/gns3fy.py", line 189, in get_projects
return self.http_call("get", url=f"{self.base_url}/projects").json()
File "/home/sever/scripts/python/gns3fy/.venv/lib/python3.10/site-packages/gns3fy/gns3fy.py", line 144, in http_call
f"{_response.json()['status']}: {_response.json()['message']}"
File "/home/sever/scripts/python/gns3fy/.venv/lib/python3.10/site-packages/requests/models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
>>>
The issue was with authentication:
by default, it requires credentials placed in ~/.config/GNS3/2.2/gns3_server.conf
But it is not clear from the Tracebkack :)
It works fine.
Tested on the linux mint
To reproduce:
check:
Another try:
Check port:
The text was updated successfully, but these errors were encountered: