hmrc.cli package

Submodules

hmrc.cli.base module

HMRC API command line

hmrc.cli.base.datestring(string)[source]

Parse date from string

class hmrc.cli.base.Command(args: argparse.Namespace)[source]

Bases: object

Command line command

Client

alias of hmrc.api.client.HmrcClient

args = None

Parsed arguments

config

Configuration

execute(client)[source]

Execute command

classmethod init_parser(parser)[source]

Initialise argument parser

section = 'DEFAULT'

Configuration file section

storage

Token storage

class hmrc.cli.base.LoginCommand(args: argparse.Namespace)[source]

Bases: hmrc.cli.base.Command

Log in to HMRC APIs

Clients = {<class 'hmrc.api.client.HmrcClient'>}

Set of all known client classes

execute(client)[source]

Execute command

classmethod init_parser(parser)[source]

Initialise argument parser

class hmrc.cli.base.LogoutCommand(args: argparse.Namespace)[source]

Bases: hmrc.cli.base.Command

Log out from HMRC APIs

execute(client)[source]

Execute command

hmrc.cli.hello module

Hello World API command line interface

class hmrc.cli.hello.HelloCommand(args: argparse.Namespace)[source]

Bases: hmrc.cli.base.Command

Hello World commands

Client

alias of hmrc.api.hello.HelloClient

section = 'hello'
class hmrc.cli.hello.HelloLoginCommand(args: argparse.Namespace)[source]

Bases: hmrc.cli.hello.HelloCommand, hmrc.cli.base.LoginCommand

Log in to Hello World API

class hmrc.cli.hello.HelloWorldCommand(args: argparse.Namespace)[source]

Bases: hmrc.cli.hello.HelloCommand

Test endpoint with no authorization

execute(client)[source]

Execute command

class hmrc.cli.hello.HelloApplicationCommand(args: argparse.Namespace)[source]

Bases: hmrc.cli.hello.HelloCommand

Test endpoint with application authorization

execute(client)[source]

Execute command

class hmrc.cli.hello.HelloUserCommand(args: argparse.Namespace)[source]

Bases: hmrc.cli.hello.HelloCommand

Test endpoint with user authorization

execute(client)[source]

Execute command

hmrc.cli.registry module

HMRC command line registry

hmrc.cli.registry.HMRC_CLI_COMMAND = 'hmrc.cli.command'

HMRC command line entry point name

class hmrc.cli.registry.CommandRegistry(parser: argparse.ArgumentParser, subcommands: Dict[str, CommandRegistry] = None, subparsers: argparse.Action = None)[source]

Bases: collections.abc.Mapping

Command registry

command(args=None)[source]

Construct command

parse(args=None)[source]

Parse arguments

parser = None

Argument parser for this (sub)command

register(group)[source]

Register command entry points

subcommands = None

Subcommands of this (sub)command

subparsers = None

Argument parser subparsers object (if subcommands exist)

hmrc.cli.registry.commands = CommandRegistry(parser=ArgumentParser(prog='__main__.py', usage=None, description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True), subcommands={'hello': CommandRegistry(parser=ArgumentParser(prog='__main__.py hello', usage=None, description='Hello World commands', formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True), subcommands={'application': CommandRegistry(parser=ArgumentParser(prog='__main__.py hello application', usage=None, description='Test endpoint with application authorization', formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True), subcommands=None), 'login': CommandRegistry(parser=ArgumentParser(prog='__main__.py hello login', usage=None, description='Log in to Hello World API', formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True), subcommands=None), 'user': CommandRegistry(parser=ArgumentParser(prog='__main__.py hello user', usage=None, description='Test endpoint with user authorization', formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True), subcommands=None), 'world': CommandRegistry(parser=ArgumentParser(prog='__main__.py hello world', usage=None, description='Test endpoint with no authorization', formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True), subcommands=None)}), 'login': CommandRegistry(parser=ArgumentParser(prog='__main__.py login', usage=None, description='Log in to HMRC APIs', formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True), subcommands=None), 'vat': CommandRegistry(parser=ArgumentParser(prog='__main__.py vat', usage=None, description='VAT commands', formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True), subcommands={'csv': CommandRegistry(parser=ArgumentParser(prog='__main__.py vat csv', usage=None, description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True), subcommands={'submit': CommandRegistry(parser=ArgumentParser(prog='__main__.py vat csv submit', usage=None, description='Submit VAT return(s) from CSV file', formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True), subcommands=None)}), 'excel': CommandRegistry(parser=ArgumentParser(prog='__main__.py vat excel', usage=None, description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True), subcommands={'submit': CommandRegistry(parser=ArgumentParser(prog='__main__.py vat excel submit', usage=None, description='Submit VAT return(s) from Excel file', formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True), subcommands=None)}), 'login': CommandRegistry(parser=ArgumentParser(prog='__main__.py vat login', usage=None, description='Log in to VAT API', formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True), subcommands=None), 'obligations': CommandRegistry(parser=ArgumentParser(prog='__main__.py vat obligations', usage=None, description='Retrieve VAT obligations', formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True), subcommands=None), 'return': CommandRegistry(parser=ArgumentParser(prog='__main__.py vat return', usage=None, description='Retrieve VAT return', formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True), subcommands=None), 'submit': CommandRegistry(parser=ArgumentParser(prog='__main__.py vat submit', usage=None, description='Submit VAT return', formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True), subcommands=None)})})

Registry of all commands

hmrc.cli.registry.main(args=None)[source]

Command line entry point

hmrc.cli.vat module

VAT API command line interface

class hmrc.cli.vat.VatBox[source]

Bases: enum.Enum

VAT form box descriptions

BOX1 = 'VAT due on sales'
BOX2 = 'VAT due on acquisitions'
BOX3 = 'Total VAT due'
BOX4 = 'VAT reclaimed'
BOX5 = 'Net VAT due'
BOX6 = 'Total sales (ex VAT)'
BOX7 = 'Total purchases (ex VAT)'
BOX8 = 'Total supplies (ex VAT)'
BOX9 = 'Total acquisitions (ex VAT)'
hmrc.cli.vat.format_vat_return(ret, draft=False)[source]

Format a VAT return (or submission) for human consumption

class hmrc.cli.vat.VatCommand(args: argparse.Namespace)[source]

Bases: hmrc.cli.base.Command

VAT commands

Client

alias of hmrc.api.vat.VatClient

classmethod init_parser(parser)[source]

Initialise argument parser

section = 'vat'
class hmrc.cli.vat.VatLoginCommand(args: argparse.Namespace)[source]

Bases: hmrc.cli.vat.VatCommand, hmrc.cli.base.LoginCommand

Log in to VAT API

class hmrc.cli.vat.VatObligationsCommand(args: argparse.Namespace)[source]

Bases: hmrc.cli.vat.VatCommand

Retrieve VAT obligations

execute(client)[source]

Execute command

classmethod init_parser(parser)[source]

Initialise argument parser

class hmrc.cli.vat.VatSubmitCommand(args: argparse.Namespace)[source]

Bases: hmrc.cli.vat.VatCommand

Submit VAT return

execute(client)[source]

Execute command

classmethod init_parser(parser)[source]

Initialise argument parser

class hmrc.cli.vat.VatReturnCommand(args: argparse.Namespace)[source]

Bases: hmrc.cli.vat.VatCommand

Retrieve VAT return

execute(client)[source]

Execute command

classmethod init_parser(parser)[source]

Initialise argument parser

Module contents

HMRC API command line interface