Skip to content
Back to top
View this page

# twine.exceptions module

Module containing exceptions raised by twine.

exception twine.exceptions.TwineException

  Base class for all exceptions raised by twine.

exception twine.exceptions.RedirectDetected

  A redirect was detected that the user needs to resolve.

  In some cases, requests refuses to issue a new POST request after a redirect. In order to prevent a confusing user experience, we raise this exception to allow users to know the index they’re uploading to is redirecting them.

  classmethod from_args(repository_url: str, redirect_url: str) → RedirectDetected

exception twine.exceptions.PackageNotFound

  A package file was provided that could not be found on the file system.

  This is only used when attempting to register a package_file.

exception twine.exceptions.UploadToDeprecatedPyPIDetected

  An upload attempt was detected to deprecated PyPI domains.

  The sites pypi.python.org and testpypi.python.org are deprecated.

  classmethod from_args(target_url: str, default_url: str, test_url: str) → UploadToDeprecatedPyPIDetected

    Return an UploadToDeprecatedPyPIDetected instance.

exception twine.exceptions.UnsupportedConfiguration

  An upload attempt was detected using features not supported by a repository.

  The features specified either in configuration or on the command-line.

  class Builder

    Build the parameters for an UnsupportedConfiguration exception.

    In the event we add additional features we are not allowing with something other than PyPI or TestPyPI, we can use a builder to accumulate them all instead of requiring someone to run multiple times to discover all unsupported configuration options.

    __init__() → None
    repository_url: str
    features: List[str]
    with_repository_url(repository_url: str) → Builder
    with_feature(feature: str) → Builder
    finalize() → UnsupportedConfiguration

exception twine.exceptions.UnreachableRepositoryURLDetected

  An upload attempt was detected to a URL without a protocol prefix.

  All repository URLs must have a protocol (e.g., `https://`).

exception twine.exceptions.InvalidSigningConfiguration

  Both the sign and identity parameters must be present.

exception twine.exceptions.InvalidSigningExecutable

  Signing executable must be installed on system.

exception twine.exceptions.InvalidConfiguration

  Raised when configuration is invalid.

exception twine.exceptions.InvalidDistribution

  Raised when a distribution is invalid.

exception twine.exceptions.NonInteractive

  Raised in non-interactive mode when credentials could not be found.

exception twine.exceptions.TrustedPublishingFailure

  Raised if we expected to use trusted publishing but couldn’t.

exception twine.exceptions.InvalidPyPIUploadURL

  Repository configuration tries to use PyPI with an incorrect URL.

  For example, https://pypi.org instead of https://upload.pypi.org/legacy.