This repository has been archived on 2022-08-04. You can view files and clone it, but cannot push or open issues or pull requests.
twtxt-registry-client/docs/index.rst

6.1 KiB

twtxt-registry-client

genindex - modindex - search

image

image

image

image

image

image

image

image

image

A Python CLI for the twtxt registry API.

Installation

This package has a very standard Python setup:

pip install twtxt_registry_client

That's it, nothing more.

Usage

Base arguments

$ twtxt-registry
  [--version]
  [--help]
  [-k|-insecure]
  [-f [raw|json|pretty]]
  REGISTRY_URL
  COMMAND
  [subcommand args]
--version

Output the CLI's version number and exit.

--help

Output the main help text and exit.

-k / --insecure

Disable SSL certificate checks; first added for the twtxt demo registry as it is appears to be unmaintained and has an expired certificate.

-f / --format with one of raw, json or pretty

Use a specific Formatter <twtxt_registry_client.output.Formatter> class to output the HTTP responses.

REGISTRY_URL

Base URL to a twtxt registry's API.

Note

The recommended base path for registry APIs is at http://host/api, but the registry API specification does not enforce it. Therefore, on most registries, you will need to append /api to the hostname.

COMMAND [subcommand args]

A client subcommand; see the subcommand-specific sections below.

Registration

$ twtxt-registry
  [...base arguments...]
  register
  [--help]
  [-n|--nickname [NICK]]
  [-u|--url [URL]]
--help

Output the subcommand help text and exit.

-n [NICK] / --nickname [NICK]

Set a custom nickname. If omitted, the CLI will try to read it from the twtxt client's standard configuration; this may not work with other twtxt implementations.

-u [URL] / --url [URL]

Set a custom public URL. If omitted, the CLI will try to read it from the twtxt client's standard configuration; this may not work with other twtxt implementations.

This subcommand outputs the HTTP response directly, see Formatter.format_response() <twtxt_registry_client.output.Formatter.format_response>.

List users

$ twtxt-registry
  [...base arguments...]
  users
  [--help]
  [-q|--query [TEXT]]
--help

Output the subcommand help text and exit.

-q [TEXT] / --query [TEXT]

Optionally filter users by a query.

This subcommand outputs the users list, see Formatter.format_users() <twtxt_registry_client.output.Formatter.format_users>. If the registry returns an HTTP 4xx or 5xx error code, the response is printed directly. See Formatter.format_response() <twtxt_registry_client.output.Formatter.format_response>.

List tweets

$ twtxt-registry
  [...base arguments...]
  tweets
  [--help]
  [-q|--query [TEXT]]
--help

Output the subcommand help text and exit.

-q [TEXT] / --query [TEXT]

Optionally filter tweets by a query.

This subcommand outputs the tweets list, see Formatter.format_tweets() <twtxt_registry_client.output.Formatter.format_tweets>. If the registry returns an HTTP 4xx or 5xx error code, the response is printed directly. See Formatter.format_response() <twtxt_registry_client.output.Formatter.format_response>.

List tweets by mention

$ twtxt-registry
  [...base arguments...]
  mentions
  [--help]
  [NAME_OR_URL]
--help

Output the subcommand help text and exit.

NAME_OR_URL

Name or URL of a user to list mentions to.

If a name is specified, the CLI will try to deduce its URL from the twtxt client's configuration. If nothing is specified, the CLI will use the configured public URL to default to the local user. This may not work on other twtxt implementations.

This subcommand outputs the tweets list, see Formatter.format_tweets() <twtxt_registry_client.output.Formatter.format_tweets>. If the registry returns an HTTP 4xx or 5xx error code, the response is printed directly. See Formatter.format_response() <twtxt_registry_client.output.Formatter.format_response>.

List tweets by tag

$ twtxt-registry
  [...base arguments...]
  tag
  [--help]
  NAME
--help

Output the subcommand help text and exit.

NAME

Tag to list tweets for.

This subcommand outputs the tweets list, see Formatter.format_tweets() <twtxt_registry_client.output.Formatter.format_tweets>. If the registry returns an HTTP 4xx or 5xx error code, the response is printed directly. See Formatter.format_response() <twtxt_registry_client.output.Formatter.format_response>.

Learn more

output contributing