def http(*args, **kwargs): http_kwargs = { 'stdin_isatty': True, 'stdout_isatty': False } http_kwargs.update(kwargs) stdout = http_kwargs.setdefault('stdout', StringIO()) __main__.main(args=args, **http_kwargs) return stdout.getvalue()
def http(*args, **kwargs): http_kwargs = {'stdin_isatty': True, 'stdout_isatty': False} http_kwargs.update(kwargs) stdout = http_kwargs.setdefault('stdout', tempfile.TemporaryFile()) __main__.main(args=args, **http_kwargs) stdout.seek(0) response = stdout.read().decode('utf8') stdout.close() return response
def http(*args, **kwargs): http_kwargs = { 'stdin_isatty': True, 'stdout_isatty': False } http_kwargs.update(kwargs) stdout = http_kwargs.setdefault('stdout', tempfile.TemporaryFile()) __main__.main(args=args, **http_kwargs) stdout.seek(0) response = stdout.read().decode('utf8') stdout.close() return response
def http(*args, **kwargs): """ Invoke `httpie.__main__.main` with `args` and `kwargs`, and return a unicode response. """ http_kwargs = { 'stdin_isatty': True, 'stdout_isatty': False } http_kwargs.update(kwargs) stdout = http_kwargs.setdefault('stdout', tempfile.TemporaryFile()) __main__.main(args=args, **http_kwargs) stdout.seek(0) response = stdout.read().decode('utf8') stdout.close() return response
def http(*args, **kwargs): http_kwargs = {'stdin_isatty': True, 'stdout_isatty': False} http_kwargs.update(kwargs) stdout = http_kwargs.setdefault('stdout', StringIO()) __main__.main(args=args, **http_kwargs) return stdout.getvalue()
from httpie.__main__ import main if __name__ == '__main__': import sys sys.exit(main())