mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 11:18:11 +00:00
Send GNS 3 server version in header and upgrade aiohttp
This commit is contained in:
parent
df8bdcc152
commit
9abf323e7d
@ -19,6 +19,8 @@ import json
|
|||||||
import jsonschema
|
import jsonschema
|
||||||
import aiohttp.web
|
import aiohttp.web
|
||||||
import logging
|
import logging
|
||||||
|
import sys
|
||||||
|
from ..version import __version__
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -30,6 +32,7 @@ class Response(aiohttp.web.Response):
|
|||||||
self._route = route
|
self._route = route
|
||||||
self._output_schema = output_schema
|
self._output_schema = output_schema
|
||||||
headers['X-Route'] = self._route
|
headers['X-Route'] = self._route
|
||||||
|
headers['Server'] = "Python/{0[0]}.{0[1]} GNS3/{1}".format(sys.version_info, __version__)
|
||||||
super().__init__(headers=headers, **kwargs)
|
super().__init__(headers=headers, **kwargs)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -42,6 +45,7 @@ class Response(aiohttp.web.Response):
|
|||||||
def json(self, answer):
|
def json(self, answer):
|
||||||
"""Pass a Python object and return a JSON as answer"""
|
"""Pass a Python object and return a JSON as answer"""
|
||||||
|
|
||||||
|
print(self.headers)
|
||||||
self.content_type = "application/json"
|
self.content_type = "application/json"
|
||||||
if hasattr(answer, '__json__'):
|
if hasattr(answer, '__json__'):
|
||||||
answer = answer.__json__()
|
answer = answer.__json__()
|
||||||
|
@ -4,4 +4,4 @@ pycurl==7.19.5
|
|||||||
python-dateutil==2.3
|
python-dateutil==2.3
|
||||||
apache-libcloud==0.16.0
|
apache-libcloud==0.16.0
|
||||||
requests==2.5.0
|
requests==2.5.0
|
||||||
aiohttp==0.13.1
|
aiohttp==0.14.2
|
||||||
|
Loading…
Reference in New Issue
Block a user