mirror of
https://github.com/httpie/cli.git
synced 2025-01-10 00:28:12 +02:00
Cleanup
This commit is contained in:
parent
45e8e4e4ea
commit
c946b3d34f
@ -19,8 +19,6 @@ from httpie.utils import repr_dict
|
||||
try:
|
||||
# noinspection PyPackageRequirements
|
||||
import urllib3
|
||||
|
||||
|
||||
# <https://urllib3.readthedocs.io/en/latest/security.html>
|
||||
urllib3.disable_warnings()
|
||||
except (ImportError, AttributeError):
|
||||
@ -128,10 +126,10 @@ def get_response(
|
||||
|
||||
with max_headers(args.max_headers):
|
||||
if not args.session and not args.session_read_only:
|
||||
kwargs = make_requests_kwargs(args)
|
||||
requests_kwargs = make_requests_kwargs(args)
|
||||
if args.debug:
|
||||
dump_request(kwargs)
|
||||
response = requests_session.request(**kwargs)
|
||||
dump_request(requests_kwargs)
|
||||
response = requests_session.request(**requests_kwargs)
|
||||
else:
|
||||
response = sessions.get_response(
|
||||
requests_session=requests_session,
|
||||
|
@ -1,14 +1,16 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
import json
|
||||
from typing import Type
|
||||
from typing import Optional, Type
|
||||
|
||||
import pygments.lexer
|
||||
import pygments.token
|
||||
import pygments.styles
|
||||
import pygments.lexers
|
||||
import pygments.style
|
||||
import pygments.styles
|
||||
import pygments.token
|
||||
from pygments.formatters.terminal import TerminalFormatter
|
||||
from pygments.formatters.terminal256 import Terminal256Formatter
|
||||
from pygments.lexer import Lexer
|
||||
from pygments.lexers.special import TextLexer
|
||||
from pygments.lexers.text import HttpLexer as PygmentsHttpLexer
|
||||
from pygments.util import ClassNotFound
|
||||
@ -26,7 +28,6 @@ if is_windows:
|
||||
# great and fruity seems to give the best result there.
|
||||
DEFAULT_STYLE = 'fruity'
|
||||
|
||||
|
||||
AVAILABLE_STYLES = set(pygments.styles.get_all_styles())
|
||||
AVAILABLE_STYLES.add(SOLARIZED_STYLE)
|
||||
AVAILABLE_STYLES.add(AUTO_STYLE)
|
||||
@ -90,7 +91,7 @@ class ColorFormatter(FormatterPlugin):
|
||||
def get_lexer_for_body(
|
||||
self, mime: str,
|
||||
body: str
|
||||
) -> Type[pygments.lexer.Lexer]:
|
||||
) -> Optional[Type[Lexer]]:
|
||||
return get_lexer(
|
||||
mime=mime,
|
||||
explicit_json=self.explicit_json,
|
||||
@ -109,8 +110,7 @@ def get_lexer(
|
||||
mime: str,
|
||||
explicit_json=False,
|
||||
body=''
|
||||
) -> Type[pygments.lexer.Lexer]:
|
||||
|
||||
) -> Optional[Type[Lexer]]:
|
||||
# Build candidate mime type and lexer names.
|
||||
mime_types, lexer_names = [mime], []
|
||||
type_, subtype = mime.split('/', 1)
|
||||
|
Loading…
Reference in New Issue
Block a user