httpie / cli

🥧 HTTPie CLI — modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more.
https://httpie.io
BSD 3-Clause "New" or "Revised" License
33.87k stars 3.68k forks source link

--offline not being recognized #1299

Closed igorcafe closed 2 years ago

igorcafe commented 2 years ago

Checklist


OS: Ubuntu 20.04 LTS

Minimal reproduction code and steps

  1. pip3 install httpie
  2. http google.com --offline

Current result

http: error: unrecognized arguments: --offline

Expected result

image

https://httpie.io/docs/cli/introduction


Debug output

Please re-run the command with --debug, then copy the entire command & output and paste both below:

HTTPie 1.0.3
Requests 2.22.0
Pygments 2.3.1
Python 3.8.10 (default, Nov 26 2021, 20:14:08) 
[GCC 9.3.0]
/usr/bin/python3
Linux 5.13.0-28-generic

<Environment {
    "colors": 256,
    "config": {
        "__meta__": {
            "about": "HTTPie configuration file",
            "help": "https://httpie.org/doc#config",
            "httpie": "1.0.3"
        },
        "default_options": "[]"
    },
    "config_dir": "/home/igor/.httpie",
    "is_windows": false,
    "stderr": "<_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>",
    "stderr_isatty": true,
    "stdin": "<_io.TextIOWrapper name='<stdin>' mode='r' encoding='utf-8'>",
    "stdin_encoding": "utf-8",
    "stdin_isatty": true,
    "stdout": "<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>",
    "stdout_encoding": "utf-8",
    "stdout_isatty": true
}>
usage: http [--json] [--form] [--pretty {all,colors,format,none}] [--style STYLE] [--print WHAT] [--headers] [--body] [--verbose] [--all]
            [--history-print WHAT] [--stream] [--output FILE] [--download] [--continue]
            [--session SESSION_NAME_OR_PATH | --session-read-only SESSION_NAME_OR_PATH] [--auth USER[:PASS]] [--auth-type {basic,digest}]
            [--proxy PROTOCOL:PROXY_URL] [--follow] [--max-redirects MAX_REDIRECTS] [--timeout SECONDS] [--check-status] [--verify VERIFY]
            [--ssl {ssl2.3,tls1,tls1.1,tls1.2}] [--cert CERT] [--cert-key CERT_KEY] [--ignore-stdin] [--help] [--version] [--traceback]
            [--default-scheme DEFAULT_SCHEME] [--debug]
            [METHOD] URL [REQUEST_ITEM [REQUEST_ITEM ...]]
http: error: unrecognized arguments: --offline

Additional information, screenshots, or code examples

https://httpie.io/docs/cli/introduction

isidentical commented 2 years ago

Hey @igoracmelo! The HTTPie command accepts our request data syntax after the URL. That is the reason you can't pass it. The correct way should be:

$ http --offline google.com
ko2in commented 2 years ago

As the error in the console clearly says the --offline argument is no longer recognized. I'm not sure why this issue was closed.

Screenshot from 2022-08-04 17-58-35

jkbrzt commented 2 years ago

@ko2in this looks like an ancient version of HTTPie. I recommend upgrading to the latest version (https://httpie.io/docs/cli/installation).

ko2in commented 2 years ago

@jakubroztocil Thanks. I installed via snap. I've tried snap refresh httpie but it says no updates available.

Screenshot from 2022-08-04 18-09-36

jkbrzt commented 2 years ago

@ko2in what does http --version say?

ko2in commented 2 years ago

The version is 1.0.3, and OS is Ubuntu 20.04 LTS.

Screenshot from 2022-08-04 18-20-33

ko2in commented 2 years ago

@jakubroztocil I've checked the snap and the httpie version is 3.2.1.

Screenshot from 2022-08-04 19-32-57

And https --version also returns the same version and the --offline argument works with https command.

Screenshot from 2022-08-04 19-35-31

jkbrzt commented 2 years ago

@ko2in you may have the 1.0.3 version installed using another method (e.g., pip or apt). So if you uninstall it (and reinstall the newer snap, if needed), you should be good.

ko2in commented 2 years ago

@jakubroztocil You're right. I've also httpie installed with apt. I uninstall from apt and now it works. Thanks.