/usr/share/pyshared/restkit/session.py is in python-restkit 4.2.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | # -*- coding: utf-8 -
#
# This file is part of restkit released under the MIT license.
# See the NOTICE for more information.
from socketpool import ConnectionPool
from restkit.conn import Connection
_default_session = {}
def get_session(backend_name, **options):
global _default_session
if not _default_session:
_default_session = {}
pool = ConnectionPool(factory=Connection,
backend=backend_name, **options)
_default_session[backend_name] = pool
else:
if backend_name not in _default_session:
pool = ConnectionPool(factory=Connection,
backend=backend_name, **options)
_default_session[backend_name] = pool
else:
pool = _default_session.get(backend_name)
return pool
def set_session(backend_name, **options):
global _default_session
if not _default_session:
_default_session = {}
if backend_name in _default_session:
pool = _default_session.get(backend_name)
else:
pool = ConnectionPool(factory=Connection,
backend=backend_name, **options)
_default_session[backend_name] = pool
return pool
|