示例#1
0
文件: tests.py 项目: kubami/httpie
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()
示例#2
0
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
示例#3
0
文件: tests.py 项目: dair-targ/httpie
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
示例#4
0
文件: tests.py 项目: brainv/httpie
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
示例#5
0
文件: tests.py 项目: nz/httpie
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()
示例#6
0
文件: http_cli.py 项目: git2u/httpie
from httpie.__main__ import main

if __name__ == '__main__':
    import sys
    sys.exit(main())