Pyjoyment.Command.get - Get command

Usage: APPLICATION get [OPTIONS] URL [SELECTOR|JSON-POINTER] [COMMANDS]

  ./myapp.py get /
  ./myapp.py get -H 'Accept: text/html' /hello.html 'head > title' text
  ./myapp.py get //sri:secr3t@/secrets.json /1/content
  pyjo get mojolicious.org
  pyjo get -v -r -o 25 -i 50 google.com
  pyjo get -v -H 'Host: mojolicious.org' -H 'Accept: */*' mojolicious.org
  pyjo get -u 'sri:s3cret' https://mojolicious.org
  pyjo get mojolicious.org > example.html
  pyjo get -M PUT mojolicious.org < example.html
  pyjo get -f 'q=Mojolicious' -f 'size=5' https://metacpan.org/search
  pyjo get -M POST -f 'upload=@example.html' mojolicious.org
  pyjo get mojolicious.org 'head > title' text
  pyjo get mojolicious.org .footer all
  pyjo get mojolicious.org a attr href
  pyjo get mojolicious.org '*' attr id
  pyjo get mojolicious.org 'h1, h2, h3' 3 text
  pyjo get https://pypi.org/pypi/Pyjoyment/json /info/version
  pyjo get -H 'Host: example.com' http+unix://%2Ftmp%2Fmyapp.sock/index.html

Options:
  -C, --charset <charset>              Charset of HTML/XML content, defaults
                                       to auto-detection
  -c, --content <content>              Content to send with request
  -f, --form <name=value>              One or more form values and file
                                       uploads
  -H, --header <name:value>            One or more additional HTTP headers
  -h, --help                           Show this summary of available options
      --home <path>                    Path to home directory of your
                                       application, defaults to the value of
                                       PYJO_HOME or auto-detection
  -i, --inactivity-timeout <seconds>   Inactivity timeout, defaults to the
                                       value of PYJO_INACTIVITY_TIMEOUT or 40
  -k, --insecure                       Do not require a valid TLS certificate
                                       to access HTTPS sites
      --log-format <name>              Format of log messages, "text",
                                       "plain" without time and process, or
                                       "json", defaults to the value of
                                       PYJO_LOG_FORMAT or "text"
  -M, --method <method>                HTTP method to use, defaults to "GET"
  -m, --mode <name>                    Operating mode for your application,
                                       defaults to the value of PYJO_MODE or
                                       "development"
  -o, --connect-timeout <seconds>      Connect timeout, defaults to the value
                                       of PYJO_CONNECT_TIMEOUT or 10
  -r, --redirect                       Follow up to 10 redirects
  -S, --response-size <size>           Maximum response size in bytes,
                                       defaults to 2147483648 (2GiB)
  -u, --user <userinfo>                Alternate mechanism for specifying
                                       colon-separated username and password
  -v, --verbose                        Print request and response headers to
                                       STDERR

Pyjoyment.Command.get performs requests to remote hosts or local applications.

This is a core command, that means it is always enabled and its code a good example for learning to build new commands, you’re welcome to fork it.

See Pyjoyment.Commands for a list of commands that are available by default.

See also

Pyjoyment, https://mojolicious.org.

Ported from Mojolicious::Command::get of Mojolicious 9.49.

Classes

class Pyjoyment.Command.get.Pyjoyment_Command_get(**kwargs: Any)[source]

Pyjoyment.Command.get inherits all attributes and methods from Pyjoyment.Command and implements the following new ones.

description = 'Perform HTTP request'
description = get.description
get.description = 'Foo'

Short description of this command, used for the command list.

run(*args: str) → None[source]
get.run(*sys.argv[1:])

Run this command.

usage = 'Usage: APPLICATION get [OPTIONS] URL [SELECTOR|JSON-POINTER] [COMMANDS]\n\n  ./myapp.py get /\n  ./myapp.py get -H \'Accept: text/html\' /hello.html \'head > title\' text\n  ./myapp.py get //sri:secr3t@/secrets.json /1/content\n  pyjo get mojolicious.org\n  pyjo get -v -r -o 25 -i 50 google.com\n  pyjo get -v -H \'Host: mojolicious.org\' -H \'Accept: */*\' mojolicious.org\n  pyjo get -u \'sri:s3cret\' https://mojolicious.org\n  pyjo get mojolicious.org > example.html\n  pyjo get -M PUT mojolicious.org < example.html\n  pyjo get -f \'q=Mojolicious\' -f \'size=5\' https://metacpan.org/search\n  pyjo get -M POST -f \'upload=@example.html\' mojolicious.org\n  pyjo get mojolicious.org \'head > title\' text\n  pyjo get mojolicious.org .footer all\n  pyjo get mojolicious.org a attr href\n  pyjo get mojolicious.org \'*\' attr id\n  pyjo get mojolicious.org \'h1, h2, h3\' 3 text\n  pyjo get https://pypi.org/pypi/Pyjoyment/json /info/version\n  pyjo get -H \'Host: example.com\' http+unix://%2Ftmp%2Fmyapp.sock/index.html\n\nOptions:\n  -C, --charset <charset>              Charset of HTML/XML content, defaults\n                                       to auto-detection\n  -c, --content <content>              Content to send with request\n  -f, --form <name=value>              One or more form values and file\n                                       uploads\n  -H, --header <name:value>            One or more additional HTTP headers\n  -h, --help                           Show this summary of available options\n      --home <path>                    Path to home directory of your\n                                       application, defaults to the value of\n                                       PYJO_HOME or auto-detection\n  -i, --inactivity-timeout <seconds>   Inactivity timeout, defaults to the\n                                       value of PYJO_INACTIVITY_TIMEOUT or 40\n  -k, --insecure                       Do not require a valid TLS certificate\n                                       to access HTTPS sites\n      --log-format <name>              Format of log messages, "text",\n                                       "plain" without time and process, or\n                                       "json", defaults to the value of\n                                       PYJO_LOG_FORMAT or "text"\n  -M, --method <method>                HTTP method to use, defaults to "GET"\n  -m, --mode <name>                    Operating mode for your application,\n                                       defaults to the value of PYJO_MODE or\n                                       "development"\n  -o, --connect-timeout <seconds>      Connect timeout, defaults to the value\n                                       of PYJO_CONNECT_TIMEOUT or 10\n  -r, --redirect                       Follow up to 10 redirects\n  -S, --response-size <size>           Maximum response size in bytes,\n                                       defaults to 2147483648 (2GiB)\n  -u, --user <userinfo>                Alternate mechanism for specifying\n                                       colon-separated username and password\n  -v, --verbose                        Print request and response headers to\n                                       STDERR\n'
usage = get.usage
get.usage = 'Foo'

Usage information for this command, used for the help screen.