cznic/public/: fred-eppic-2.0.0 metadata and description

Simple index Newer version available

Fred-eppic is EPP Interactive Client.

author Filip Úradník
author_email filip.uradnik@nic.cz
classifiers
  • Development Status :: 4 - Beta
  • Environment :: Console
  • Intended Audience :: Information Technology
  • License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
  • Operating System :: OS Independent
  • Programming Language :: Python
  • Programming Language :: Python :: 3.8
  • Programming Language :: Python :: 3.9
  • Programming Language :: Python :: 3.10
  • Programming Language :: Python :: 3.11
  • Topic :: Internet
  • Topic :: Internet :: Name Service (DNS)
  • Topic :: Utilities
  • Typing :: Typed
license GPLv3+
provides_extras types
requires_dist
  • click
  • fred-epplib ~=1.1
  • prompt-toolkit
  • pydantic ~=1.8
  • pygments
  • PyYAML
  • bandit ; extra == 'quality'
  • doc8 ; extra == 'quality'
  • flake8 ; extra == 'quality'
  • isort ; extra == 'quality'
  • mypy ; extra == 'quality'
  • pydocstyle ; extra == 'quality'
  • testfixtures ; extra == 'test'
  • types-PyYAML ; extra == 'types'
requires_python ~=3.8

Because this project isn't in the mirror_whitelist, no releases from root/pypi are included.

File Tox results History
fred-eppic-2.0.0.tar.gz
Size
55 KB
Type
Source
fred_eppic-2.0.0-py3-none-any.whl
Size
68 KB
Type
Python Wheel
Python
3

Fred-eppic is EPP Interactive Client.

Learn more about the project and our community on the FRED’s home page.

Configuration

You can configure EPPIC using a configuration file. On startup, EPPIC looks for a configuration file in two places. First, in your home directory, for a file called $HOME/.eppic.conf. Only if it can’t find it, it looks for /etc/eppic/eppic.conf. If that file doesn’t exist either, it loads its default config.

Some config options, including the place where EPPIC looks for the configuration file, can be overriden with command-line arguments. Details are described in the Command-line arguments section.

The configuration file is expected to be in the YAML format. It will be loaded using safe_load, meaning it doesn’t support any advanced YAML features, such as executing code.

Session

Before we take a look at the config file itself, we should talk about sessions.

A session holds information and settings for your connection to the EPP server. The configuration allows you to specify multiple sessions, and then choose the one you want to use.

If there are no sessions specified, you will startup with an error message. If there are sessions specified in your configuration file, and you don’t say otherwise, the client will start up with first session loaded. If you want to choose another session, you can either use the --session-id=<session_id> parameter when starting the client, or run the switch-session <session_id> command when the client is running.

The <session_id> argument can either be a number, meaning you want the n-th session (from the top, numbers start from zero), or it can be a string, in which case EPPIC will start with a session with the matching alias. If you didn’t define an alias, username will be used instead.

Config description

Here, you can find the descriptions of all supported config options. There is a sample config file in the repository.

sessions

A list of defined sessions. Each session has following subkeys:

  • hostname: Address of the server.

  • port: Port over which to connect. Default value is 700.

  • cert_file: Path to the certificate file. Default is None.

  • key_file: Path to the key file. Default is None.

  • obj_uris: A list of object namespace uris more information can be found in the Namespaces and Schemas section of FRED documentation. Default value is a list:

    • http://www.nic.cz/xml/epp/contact-1.6

    • http://www.nic.cz/xml/epp/domain-1.4

    • http://www.nic.cz/xml/epp/nsset-1.2

    • http://www.nic.cz/xml/epp/keyset-1.3

  • username: The client id.

  • password: Password corresponding to the client id.

  • verify (optional): Whether or not to verify the certificate when communicating with the server. It is highly encouraged to keep this true!

  • alias (optional): The alias for this session. This can be used as an identifier for the session when using the switch-session command. If it is not specified, the username will be used.

input_file (optional)

Path to a file from which the client can take input. Default: stdin.

input_format (optional)

Format in which input is expected. Default: DEFAULT. Accepted values are:

  • DEFAULT - described in the Default command format section.

  • JSON - on each line a dictionary containing one key - the command, with its subkeys being the arguments.

  • YAML - a valid YAML file (can have multiple documents), each document has one key - the command, with its subkeys being the arguments.

output_format (optional)

Format in which output is printed to stdout. Default: DEFAULT. Accepted values are:

  • DEFAULT - described in the Default command format section.

  • JSON - on each line a dictionary containing one key - the command, with its subkeys being the arguments.

  • YAML - a valid YAML file (can have multiple documents), each document has one key - the command, with its subkeys being the arguments.

logging (optional)

a dictionary specifying the logging configuration. For more info, read the Python Logging Dict Schema Wiki. Defaults to basic Python configuration.

interactive_input (optional)

Advanced settings specifying details about interactive input.

  • autocomplete: Whether or not to autocomplete when typing. Default: true.

  • history_file_path: Path to a file (doesn’t need to exist) where history should be saved for autosuggestions. Default: $HOME/.cache/eppic/autosuggest_history

syntax_highlighting (optional)

Turn syntax highlighting on/off for input and output. Default: true.

command_confirmation (optional)

Whether or not to ask for confirmation before sending commands to the server. Default: false.

Command-line arguments

The client supports a number of command-line arguments. They are:

  • --session-id: specifies <session_id>. More on that in Session.

  • --input-file: overrides the input_file config option.

  • --config: overrides the path to the config.

If you only want to run one command, you can do so without opening the interactive client. You can simply add -- after the last command-line argument, and add the command after that.

For example:

eppic --session-id=2 -- info-domain nic.cz

would start EPPIC, login with the pre-defined session number 2, run the command info-domain nic.cz, print its response, and then logout and exit.

Default command format

The default command has the following format:

<command-name> (--<argument-name>.<subargument-name>)(=)<argument-value> ...

For example:

info-domain --name=nic.cz

When it is obvious what argument should follow, you can skip its name, and just say:

info-domain nic.cz

which is equivalent to the command above.

Some commands allow you to skip the names of all their arguments, such as list or check commands. Commands that have more complicated arguments require you to put in their names to avoid ambiguity and possibly unwanted and unexpected behaviour.

There are both autocomplete and autosuggestion features in the interactive client, which are enabled by default. The autocompletion gives you a list of completions from the currently available arguments, and it should allow you to write much less than you would without it. It can also show you which arguments are optional – those are in parentheses. For some arguments, the values are from a given range. There, the autosuggestion can even fill in the values for you.

Some arguments allow you to insert a list of values. In check commands you don’t have to fill in the names at all, but in other commands, you have to use the explicit names, and each argument from the list has to have a unique name. The autocompletion will automatically add numbers to the end of the names of list arguments, such as <argument-name>_1. You can keep with this naming style, but you can also put any numbers or letters after the original argument name.

For example, the check-domain command has one list argument, names. To check the domains nic.cz, foo.cz and bar.cz, the following command can be used:

check-domain --names_1=nic.cz --names_2=foo.cz --names_3=bar.cz

Argument names --names_1 to --names_3 are autosuggested. But the following command performs the same operation:

check-domain --names_nic=nic.cz --names_foo=foo.cz --names_bar=bar.cz

It doesn’t make much sense in this context, but in case of more complex commands, such as create-contact, it can be useful to use custom labels for the arguments.

Sometimes, you want to insert more complicated values, for example with spaces or equal signs. You can do that by using quotes (single or double). For example:

sample-command --arg="very complicated value with -- and ="

would result in arg’s value being very complicated value with -- and =. If you want to use quotes inside quotes, you can either use the other kind of quotes, or escape them using \\. For example:

sample-command --arg="very complicated value for \"name\" with \"--\" and \"=\" and \"\\\""

would result in arg’s value being very complicated value for "name" with "--" and "=" and "\".

Other command formats

The default command format is meant mostly for the interactive client. If you want to use the client programmatically, it might be better to use one of the other formats, writing the input to a file and then running EPPIC with the --input-file command-line argument.

You can set the input format in the config file, apart from DEFAULT you can choose JSON and YAML.

JSON format requires that each line in the input file is a valid JSON document containing exactly one key, which contains the arguments as its subkeys. More complicated arguments should be inserted as nested dictionaries. For example:

{"info-domain": {"name": "nic.cz"}}

If a command has no arguments, use {}.

YAML format is a bit different, and more user-friendly, because YAML, unlike JSON, allows multiple documents in one file. When writing a command in the YAML format, each document in the file should have exactly one key - the name of the command, and its subkeys should be the arguments. For example:

---
info-domain:
  name: nic.cz
...

Help command

There is a built-in help command, which gives you short help about a command and its parameters. Simpy type:

help <command-name> (<possible arguments> ...)

The help is designed to work even if you’re in the middle of writing a command, and you want to be reminded about a parameter’s meaning, for example. In that case you can simply pre-pend what you’ve already written with help, and you’ll get an answer.

If you don’t want to type as much, you can use the shortcut ctrl-space, which calls help with what you’ve already written. If you use this shortcut and want to get back to what you were writing, you can simply hit the up key twice.

If you want to get help for more commands at once, you can give it partial names, too. For example, if you wanted to get help for all info commands, you can say:

help info

and you’ll get help for all commands containing info in their name.

And finally, if you want to get help for all available commands, you can simply say help, and it will give you everything it has.

Public API specification

Public API of this application marked as compatible for the purpose of semantic versioning is a command-line interface. Specifically:

  • Command names, arguments and behaviour, regardless of the input format.

  • Structure of command outputs, with respect to the format used, in all formats except for the text output.

  • Structure of the configuration file.

Changes excluded from public API compatibility:

  • Any features marked as experimental.

  • Command behaviour changes caused by changes on the EPP server, especially changes in EPP schemas.

  • Interactive prompt features, such as history, autocompletion and command validation.

ChangeLog

Unreleased

2.0.0 (2023-08-10)

  • Enable configless run (#42).

  • Restrict positional arguments. (#96).

  • Fix and improve output (#68, #70, #82, #92).

  • Use dashes instead of underscores in argument names (#79, #111).

  • Automatically apply the disclose policy (#91).

  • Add hello command (#88).

  • Add poll commands (#93, #114).

  • Add raw-request command (#40, #102).

  • Add change-settings command (#41).

  • Add new-session command (#84).

  • Remove set-session command ().

  • Change login command ().

  • Settings validation no longer throws traceback (#55).

  • Add an option for command confirmation (#28).

  • Add an option to print results automatically on list commands.

  • Fix the option to disable auto completion (#101).

  • Disable interactive mode when running without tty (#103).

  • Add command hooks (#90, #97).

  • Move session to epp handler. (#49).

  • Fix and refactor argument processing (#71, #72, #73, #74, #77, #78, #80, #83, #85, #86, #89, #98, #104, #105, #110).

  • Close connection on send_command error. (#69).

  • Unite the models into models. (#99).

  • Fix and update tests (#68, #106, #107, #109).

  • Update project setup (#112, #116).

1.0.1 (2022-12-21)

  • Fix nested dataclass attributes (#66).

  • Output in unicode encoding (#67).

1.0.0 (2022-12-15)

  • Add support for Python 3.11.

  • Suggest required args first (#59).

  • Tweak prompt validation (#62).

  • Update session defaults (#54).

  • Fix get-results output (#60).

  • Fix representing enums in output (#56).

  • Fix subarguments’ required flag (#58).

  • Add ArgumentField object (#63, #58).

  • Public API specification (#64).

  • Update project setup.

  • Fix typing and tests (#52).

0.1.2 (2022-10-05)

  • Restrict supported pydantic versions.

0.1.1 (2022-09-29)

A number of changes and fixes for the initial version.

0.1.0 (2022-09-19)

Initial version.