Tested on the linux mint
$ cat /etc/os-release
NAME="Linux Mint"
VERSION="21 (Vanessa)"
ID=linuxmint
ID_LIKE="ubuntu debian"
PRETTY_NAME="Linux Mint 21"
VERSION_ID="21"
To reproduce:
python3 -m venv .venv
source .venv/bin/activate
pip install gns3fy
Collecting gns3fy
Downloading gns3fy-0.8.0-py3-none-any.whl (15 kB)
Collecting requests<3.0,>=2.22
Using cached requests-2.31.0-py3-none-any.whl (62 kB)
Collecting pydantic<2.0,>=1.0
Downloading pydantic-1.10.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.1/3.1 MB 7.6 MB/s eta 0:00:00
Collecting typing-extensions>=4.2.0
Using cached typing_extensions-4.9.0-py3-none-any.whl (32 kB)
Collecting urllib3<3,>=1.21.1
Using cached urllib3-2.1.0-py3-none-any.whl (104 kB)
Collecting certifi>=2017.4.17
Using cached certifi-2023.11.17-py3-none-any.whl (162 kB)
Collecting idna<4,>=2.5
Using cached idna-3.6-py3-none-any.whl (61 kB)
Collecting charset-normalizer<4,>=2
Using cached charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (142 kB)
Installing collected packages: urllib3, typing-extensions, idna, charset-normalizer, certifi, requests, pydantic, gns3fy
Successfully installed certifi-2023.11.17 charset-normalizer-3.3.2 gns3fy-0.8.0 idna-3.6 pydantic-1.10.13 requests-2.31.0 typing-extensions-4.9.0 urllib3-2.1.0
check:
$ 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)
>>>
Check port:
$ sudo netstat -tulpn | grep 3080
tcp 0 0 127.0.0.1:3080 0.0.0.0:* LISTEN 29606/python
Tested on the linux mint
To reproduce:
check:
Another try:
Check port: