Skip to content
Myr

Migrate settings to new module

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Johannes · committed by Johannes · parent 21e51b5 · Browse files · 3 files+4 added−30 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+4 added−30 removed

  • other:+4 added−30 removed

3 files+4 added−30 removed

modified:requests/__init__.py-27 removed
4 unmodified lines
5import packages6from core import *78from core import __version__910timeout = None1112class settings:13 14 def __init__(self, **settings):15 self._cache_settings(**settings)16 self._alter_settings(**settings)17 18 def __enter__(self):19 pass20 21 def __exit__(self, type, value, traceback):22 self._restore_settings()23 24 def _cache_settings(self, **settings):25 self.cache = {}26 for setting in settings:27 self.cache[setting] = globals()[setting]28 29 def _alter_settings(self, **settings):30 for setting, value in settings.items():31 globals()[setting] = value32 33 def _restore_settings(self):34 for setting, value in self.cache.items():35 globals()[setting] = value
modified:requests/api.py+3 added-2 removed
9 unmodified lines
10:license: ISC, see LICENSE for more details.1112"""1314import requests14import settings15from .models import Request, Response, AuthManager, AuthObject, auth_manager161718__all__ = ('request', 'get', 'head', 'post', 'put', 'delete')
17 unmodified lines
3637 r = Request(method=method, url=url, data=data, headers=kwargs.pop('headers', {}),38 cookiejar=kwargs.pop('cookies', None), files=kwargs.pop('files', None),39 auth=kwargs.pop('auth', auth_manager.get_auth(url)),40 timeout=kwargs.pop('timeout', requests.timeout))40 timeout=kwargs.pop('timeout', settings.timeout))41 42 r.send()4344 return r.response45
71 unmodified lines
modified:requests/core.py+1 added-1 removed
20 unmodified lines
2122from models import HTTPError, auth_manager23from api import *24from exceptions import *25from settings import *25from settings import settings