Skill: forevershu/baidudisk-mcp (version 1.0.0)

--- name: baidudisk-mcp description: Use Baidu Netdisk via mcporter + stdio MCP server with hot-reload token file credentials. Triggers when you need Baidu Netdisk operations (official 2.0 toolset + legacy aliases) from OpenClaw without storing access_token in repo files. --- # baidudisk-mcp Use this skill to run Baidu Netdisk tools through `mcporter`. ## 1) Enable server in mcporter Run: ```bash bash scripts/baidudisk_mcporter.sh register ``` This writes a `baidudisk` stdio server entry into `config/mcporter.json` with: - command: `/home/linuxbrew/.linuxbrew/bin/uv` - args: `--directory <workspace>/skills/baidudisk-mcp/server run netdisk.py` - env: `BAIDU_NETDISK_TOKEN_FILE=~/.openclaw/credentials/baidudisk.json` Check status: ```bash bash scripts/baidudisk_mcporter.sh check mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json list baidudisk ``` ## 2) Credential file and hot update Credential file (local only): `~/.openclaw/credentials/baidudisk.json` Expected keys: - `access_token` (required) - `default_dir` (recommended) Example (do not commit real token): ```json { "access_token": "<redacted>", "default_dir": "/Openclaw/baidudisk" } ``` The MCP server reads this file on **every tool call**. So token rotation only needs editing this file; no server restart is required. ## 3) 2.0 tools ### 3.1 Official-aligned tools (主推) 四个基础列表接口与 MCP tool 对应关系： - `/rest/2.0/xpan/file?method=list` → `file_list(dir?, limit?, order?, desc?, start?)` - `/rest/2.0/xpan/file?method=imagelist` → `file_image_list(parent_path?, recursion?, page?, num?, order?, desc?, web=1)` - `/rest/2.0/xpan/file?method=doclist` → `file_doc_list(parent_path?, recursion?, page?, num?, order?, desc?)` - `/rest/2.0/xpan/file?method=videolist` → `file_video_list_api(parent_path?, recursion?, page?, num?, order?, desc?, web=1)` 另保留一个历史兼容视频工具（非官方 videolist 参数模型）： - `file_video_list(dir?, recursion?, start?, limit?, order?, desc?)`（基于 `xpanfilelistall` 过滤视频） 其他工具： - `category_info(category, parent_path='/', recursion=1)` - `category_info_multi(categories, parent_path='/', recursion=1)` - `image_gettags(type=1)` - `image_gettags_summary(type=1, top=50)` - `image_search(search_type, keyword, start=0, limit=100, size?)` - `recent_list(category=3, start=0, limit=100, sortby?, order?, stime?, etime?, resolution='off')` - `file_meta(fsids, dlink?, thumb?, extra?, needmedia?, path?)` - `make_dir(path, parent_dir?)` - `file_copy(src_path, dest_dir, new_name?, ondup?)` - `file_copy_batch(items, ondup='newcopy', async_mode=1, chunk_size=100, dry_run=false, allow_dest_prefixes=['/Openclaw'])` - `file_del(path, confirm)` - `file_move(src_path, dest_dir, new_name?, ondup?)` - `file_move_batch(items, ondup='fail', async_mode=1, chunk_size=100, dry_run=false, allow_dest_prefixes=['/Openclaw'])` - `file_rename(path, new_name)` - `file_rename_batch(items, async_mode=1, chunk_size=100, dry_run=false)` - `file_upload_stdio(local_file_path, remote_dir?, remote_name?)` - `file_upload_by_url(url, remote_dir?, remote_name?, timeout_s?, max_bytes?)` - `file_upload_by_text(text, remote_dir?, remote_name?, max_chars?, max_bytes?)` - `file_keyword_search(keyword, dir?, recursion?, num?, page?)` - `file_semantics_search(...)`（当前 `unsupported` stub） - `file_sharelink_set(...)`（当前 `unsupported` stub） - `user_info()` - `get_quota(checkexpire?, checkfree?)` ### 3.2 Legacy aliases (兼容保留) - `list` - `search` - `mkdir` - `move` - `rename` - `delete` - `upload` - `download` ## 4) mcporter examples ```bash # 对齐 list：/rest/2.0/xpan/file?method=list mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.file_list dir=/ limit=3 # 对齐 imagelist：/rest/2.0/xpan/file?method=imagelist mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.file_image_list parent_path='/来自：iPhone' recursion=0 page=1 num=3 order=time desc=1 # 对齐 doclist：/rest/2.0/xpan/file?method=doclist mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.file_doc_list parent_path='/Openclaw' recursion=1 page=1 num=3 order=time desc=1 # 对齐 videolist：/rest/2.0/xpan/file?method=videolist mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.file_video_list_api parent_path='/' recursion=1 page=1 num=3 order=time desc=1 # 若根目录返回 count=0，可改 parent_path='/来自：iPhone' 或 '/Openclaw' # 官方同名：关键词搜索 mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.file_keyword_search keyword=invoice num=20 # 分类统计（单分类：图片=3） mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.category_info category=3 parent_path=/ recursion=1 # 分类统计（多分类：JSON array） mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.category_info_multi categories='[1,3,4,6]' parent_path=/ recursion=1 # 图片智能标签 mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.image_gettags type=1 # 图片智能标签摘要（按 count 取前 20） mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.image_gettags_summary type=1 top=20 # 图片关键字检索（search_type=2 表示汉字） mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.image_search \ search_type=2 keyword=截图 limit=20 size='c256_u256,c512_u512' # 图片列表（imagelist，默认 web=1 返回缩略图字段） mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.file_image_list \ parent_path='/Openclaw' recursion=1 page=1 num=10 order=time desc=1 # 按上传时间拉取最近图片 mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.recent_list \ category=3 limit=20 resolution=off # 官方同名：创建目录 mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.make_dir path=reports/2026 # 批量移动（默认 ondup=fail，不覆盖；dest 限制在 /Openclaw） mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.file_move_batch \ items='[{"src_path":"/Openclaw/inbox/a.txt","dest_dir":"/Openclaw/archive"},{"src_path":"/Openclaw/inbox/b.txt","dest_dir":"/Openclaw/archive"}]' \ chunk_size=100 async_mode=1 # 批量复制（显式冲突策略 newcopy：冲突时自动副本，不覆盖原文件） mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.file_copy_batch \ items='[{"src_path":"/Openclaw/inbox/a.txt","dest_dir":"/Openclaw/archive"}]' \ ondup=newcopy async_mode=1 # 批量重命名（dry_run 先演练） mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.file_rename_batch \ items='[{"path":"/Openclaw/archive/a.txt","new_name":"a-20260228.txt"}]' \ dry_run=true # 官方同名：本地文件上传 mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.file_upload_stdio local_file_path=/tmp/demo.txt # 官方同名：按 URL 上传（HTTP/HTTPS，带大小/超时限制） mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.file_upload_by_url url=https://example.com/demo.txt remote_dir=/Openclaw/baidudisk # 官方同名：文本上传 mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.file_upload_by_text text='hello world' remote_name=hello.txt # 官方同名：配额 mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.get_quota ``` ## 5) Batch return envelope（8.2） `file_move_batch / file_copy_batch / file_rename_batch` 统一返回： - `status`, `tool`, `dry_run`, `async_mode`, `ondup`, `chunk_size` - `total_items`, `chunks` - `summary`（[REDACTED_SECRET]） - `results`（每个 chunk：`chunk_index/items/request_preview/response(errno/taskid/info)`） - `errors`（失败 chunk 的 [REDACTED_SECRET]） ## 6) Minimal self-check（不含 delete） > 请不要直接用 `python3`（容易缺 `mcp` 依赖）。 ```bash cd /home/ubuntu/.openclaw/workspace/skills/baidudisk-mcp server/.venv/bin/python server/selfcheck_batch_filemanager.py server/.venv/bin/python server/selfcheck_misc_readonly.py # 下两项为真实只读联网检查（需要 token） BAIDU_NETDISK_TOKEN_FILE=~/.openclaw/credentials/baidudisk.json server/.venv/bin/python server/selfcheck_image_recent_readonly.py BAIDU_NETDISK_TOKEN_FILE=~/.openclaw/credentials/baidudisk.json server/.venv/bin/python server/selfcheck_lists_readonly.py # 等价写法（如果你用 uv） # uv run --directory server python selfcheck_batch_filemanager.py # uv run --directory server python selfcheck_misc_readonly.py ``` 覆盖点： - `file_move_batch`（10 条 + 分片降级） - `file_copy_batch`（`ondup=fail` 与 `ondup=newcopy`） - `file_rename_batch` - `category_info(category=3, parent_path='/', recursion=1)` - `image_gettags(type=1)` - 四个列表基础能力（只读）： - `file_list(dir='/', limit=3)` - `file_image_list(parent_path='/来自：iPhone', recursion=0, page=1, num=3, order='time', desc=1)` - `file_doc_list(parent_path='/Openclaw', recursion=1, page=1, num=3, order='time', desc=1)` - `file_video_list_api(parent_path='/', recursion=1, page=1, num=3, order='time', desc=1)`（根目录为空时回退 `/来自：iPhone` / `/Openclaw`） ## 7) Safety defaults - Never store `access_token` in repo files. - Error messages sanitize `access_token` patterns. - `delete/file_del` rejects by default unless `confirm="DELETE"`. - Batch move/copy restricts destination by `allow_dest_prefixes`（默认 `['/Openclaw']`）。 - `file_move_batch` 默认 `ondup=fail`（不覆盖）；`file_copy_batch` 默认 `ondup=newcopy`（冲突产出副本，不覆盖）。 - `file_upload_by_url` only allows `http(s)` and rejects localhost / 内网 / 保留地址；并限制下载大小与超时。

path: scripts/register_mcporter.sh
content: #!/usr/bin/env bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
WORKSPACE="$(cd "$SCRIPT_DIR/../../.." && pwd)"

exec "$WORKSPACE/scripts/baidudisk_mcporter.sh" register "$@"


path: server/openapi_client/__init__.py
content: # flake8: noqa

"""
    xpan

    xpanapi  # noqa: E501

    The version of the OpenAPI document: 0.1
    Generated by: https://openapi-generator.tech
"""


__version__ = "1.0.0"

# import ApiClient
from openapi_client.api_client import ApiClient

# import Configuration
from openapi_client.configuration import Configuration

# import exceptions
from openapi_client.exceptions import OpenApiException
from openapi_client.exceptions import ApiAttributeError
from openapi_client.exceptions import ApiTypeError
from openapi_client.exceptions import ApiValueError
from openapi_client.exceptions import ApiKeyError
from openapi_client.exceptions import ApiException


path: server/openapi_client/api/__init__.py
content: """
__init__.py
"""
# do not import all apis into this module because that uses a lot of memory and stack frames
# if you need the ability to import all apis from one package, import them with
# from openapi_client.apis import AuthApi


path: server/openapi_client/api/auth_api.py
content: """
    xpan

    xpanapi  # noqa: E501

    The version of the OpenAPI document: 0.1
    Generated by: https://openapi-generator.tech
"""


import re  # noqa: F401
import sys  # noqa: F401

from openapi_client.api_client import ApiClient, Endpoint as _Endpoint
from openapi_client.model_utils import (  # noqa: F401
    check_allowed_values,
    check_validations,
    date,
    datetime,
    file_type,
    none_type,
    validate_and_convert_types
)
from openapi_client.model.oauth_token_authorization_code_response import OauthTokenAuthorizationCodeResponse
from openapi_client.model.oauth_token_device_code_response import OauthTokenDeviceCodeResponse
from openapi_client.model.oauth_token_device_token_response import OauthTokenDeviceTokenResponse
from openapi_client.model.oauth_token_refresh_token_response import OauthTokenRefreshTokenResponse


class AuthApi(object):
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client
        self.oauth_token_code2token_endpoint = _Endpoint(
            settings={
                'response_type': (OauthTokenAuthorizationCodeResponse,),
                'auth': [],
                'endpoint_path': '/oauth/2.0/token?grant_type=authorization_code&openapi=xpansdk',
                'operation_id': 'oauth_token_code2token',
                'http_method': 'GET',
                'servers': [
                    {
                        'url': "https://openapi.baidu.com",
                        'description': "No description provided",
                    },
                ]
            },
            params_map={
                'all': [
                    'code',
                    'client_id',
                    'client_secret',
                    'redirect_uri',
                ],
                'required': [
                    'code',
                    'client_id',
                    'client_secret',
                    'redirect_uri',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'code':
                        (str,),
                    'client_id':
                        (str,),
                    'client_secret':
                        (str,),
                    'redirect_uri':
                        (str,),
                },
                'attribute_map': {
                    'code': 'code',
                    'client_id': 'client_id',
                    'client_secret': 'client_secret',
                    'redirect_uri': 'redirect_uri',
                },
                'location_map': {
                    'code': 'query',
                    'client_id': 'query',
                    'client_secret': 'query',
                    'redirect_uri': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json; charset=UTF-8'
                ],
                'content_type': [],
            },
            api_client=api_client
        )
        self.oauth_token_device_code_endpoint = _Endpoint(
            settings={
                'response_type': (OauthTokenDeviceCodeResponse,),
                'auth': [],
                'endpoint_path': '/oauth/2.0/device/code?response_type=device_code&openapi=xpansdk',
                'operation_id': 'oauth_token_device_code',
                'http_method': 'GET',
                'servers': [
                    {
                        'url': "https://openapi.baidu.com",
                        'description': "No description provided",
                    },
                ]
            },
            params_map={
                'all': [
                    'client_id',
                    'scope',
                ],
                'required': [
                    'client_id',
                    'scope',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'client_id':
                        (str,),
                    'scope':
                        (str,),
                },
                'attribute_map': {
                    'client_id': 'client_id',
                    'scope': 'scope',
                },
                'location_map': {
                    'client_id': 'query',
                    'scope': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json; charset=UTF-8'
                ],
                'content_type': [],
            },
            api_client=api_client
        )
        self.oauth_token_device_token_endpoint = _Endpoint(
            settings={
                'response_type': (OauthTokenDeviceTokenResponse,),
                'auth': [],
                'endpoint_path': '/oauth/2.0/token?grant_type=device_token&openapi=xpansdk',
                'operation_id': 'oauth_token_device_token',
                'http_method': 'GET',
                'servers': [
                    {
                        'url': "https://openapi.baidu.com",
                        'description': "No description provided",
                    },
                ]
            },
            params_map={
                'all': [
                    'code',
                    'client_id',
                    'client_secret',
                ],
                'required': [
                    'code',
                    'client_id',
                    'client_secret',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'code':
                        (str,),
                    'client_id':
                        (str,),
                    'client_secret':
                        (str,),
                },
                'attribute_map': {
                    'code': 'code',
                    'client_id': 'client_id',
                    'client_secret': 'client_secret',
                },
                'location_map': {
                    'code': 'query',
                    'client_id': 'query',
                    'client_secret': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json; charset=UTF-8'
                ],
                'content_type': [],
            },
            api_client=api_client
        )
        self.oauth_token_refresh_token_endpoint = _Endpoint(
            settings={
                'response_type': (OauthTokenRefreshTokenResponse,),
                'auth': [],
                'endpoint_path': '/oauth/2.0/token?grant_type=refresh_token&openapi=xpansdk',
                'operation_id': 'oauth_token_refresh_token',
                'http_method': 'GET',
                'servers': [
                    {
                        'url': "https://openapi.baidu.com",
                        'description': "No description provided",
                    },
                ]
            },
            params_map={
                'all': [
                    'refresh_token',
                    'client_id',
                    'client_secret',
                ],
                'required': [
                    'refresh_token',
                    'client_id',
                    'client_secret',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'refresh_token':
                        (str,),
                    'client_id':
                        (str,),
                    'client_secret':
                        (str,),
                },
                'attribute_map': {
                    'refresh_token': 'refresh_token',
                    'client_id': 'client_id',
                    'client_secret': 'client_secret',
                },
                'location_map': {
                    'refresh_token': 'query',
                    'client_id': 'query',
                    'client_secret': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json; charset=UTF-8'
                ],
                'content_type': [],
            },
            api_client=api_client
        )

    def oauth_token_code2token(
        self,
        code,
        client_id,
        client_secret,
        redirect_uri,
        **kwargs
    ):
        """oauth_token_code2token  # noqa: E501

        get accesstoken by authorization code  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.oauth_token_code2token(code, client_id, client_secret, redirect_uri, async_req=True)
        >>> result = thread.get()

        Args:
            code (str):
            client_id (str):
            client_secret (str):
            redirect_uri (str):

        Keyword Args:
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            async_req (bool): execute request asynchronously

        Returns:
            OauthTokenAuthorizationCodeResponse
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['code'] = \
            code
        kwargs['client_id'] = \
            client_id
        kwargs['client_secret'] = \
            client_secret
        kwargs['redirect_uri'] = \
            redirect_uri
        return self.oauth_token_code2token_endpoint.call_with_http_info(**kwargs)

    def oauth_token_device_code(
        self,
        client_id,
        scope,
        **kwargs
    ):
        """oauth_token_device_code  # noqa: E501

        get device code and user code  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.oauth_token_device_code(client_id, scope, async_req=True)
        >>> result = thread.get()

        Args:
            client_id (str):
            scope (str):

        Keyword Args:
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            async_req (bool): execute request asynchronously

        Returns:
            OauthTokenDeviceCodeResponse
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['client_id'] = \
            client_id
        kwargs['scope'] = \
            scope
        return self.oauth_token_device_code_endpoint.call_with_http_info(**kwargs)

    def oauth_token_device_token(
        self,
        code,
        client_id,
        client_secret,
        **kwargs
    ):
        """oauth_token_device_token  # noqa: E501

        get access_token  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.oauth_token_device_token(code, client_id, client_secret, async_req=True)
        >>> result = thread.get()

        Args:
            code (str):
            client_id (str):
            client_secret (str):

        Keyword Args:
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            async_req (bool): execute request asynchronously

        Returns:
            OauthTokenDeviceTokenResponse
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['code'] = \
            code
        kwargs['client_id'] = \
            client_id
        kwargs['client_secret'] = \
            client_secret
        return self.oauth_token_device_token_endpoint.call_with_http_info(**kwargs)

    def oauth_token_refresh_token(
        self,
        refresh_token,
        client_id,
        client_secret,
        **kwargs
    ):
        """oauth_token_refresh_token  # noqa: E501

        authorization code  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.oauth_token_refresh_token(refresh_token, client_id, client_secret, async_req=True)
        >>> result = thread.get()

        Args:
            refresh_token (str):
            client_id (str):
            client_secret (str):

        Keyword Args:
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            async_req (bool): execute request asynchronously

        Returns:
            OauthTokenRefreshTokenResponse
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['refresh_token'] = \
            refresh_token
        kwargs['client_id'] = \
            client_id
        kwargs['client_secret'] = \
            client_secret
        return self.oauth_token_refresh_token_endpoint.call_with_http_info(**kwargs)



path: server/openapi_client/api/fileinfo_api.py
content: """
    xpan

    xpanapi  # noqa: E501

    The version of the OpenAPI document: 0.1
    Generated by: https://openapi-generator.tech
"""


import re  # noqa: F401
import sys  # noqa: F401

from openapi_client.api_client import ApiClient, Endpoint as _Endpoint
from openapi_client.model_utils import (  # noqa: F401
    check_allowed_values,
    check_validations,
    date,
    datetime,
    file_type,
    none_type,
    validate_and_convert_types
)


class FileinfoApi(object):
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client
        self.xpanfiledoclist_endpoint = _Endpoint(
            settings={
                'response_type': (dict,),
                'auth': [],
                'endpoint_path': '/rest/2.0/xpan/file?method=doclist&openapi=xpansdk',
                'operation_id': 'xpanfiledoclist',
                'http_method': 'GET',
                'servers': [
                    {
                        'url': "https://pan.baidu.com",
                        'description': "No description provided",
                    },
                ]
            },
            params_map={
                'all': [
                    'access_token',
                    'parent_path',
                    'recursion',
                    'page',
                    'num',
                    'order',
                    'desc',
                    'web',
                ],
                'required': [
                    'access_token',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'access_token':
                        (str,),
                    'parent_path':
                        (str,),
                    'recursion':
                        (str,),
                    'page':
                        (int,),
                    'num':
                        (int,),
                    'order':
                        (str,),
                    'desc':
                        (str,),
                    'web':
                        (str,),
                },
                'attribute_map': {
                    'access_token': 'access_token',
                    'parent_path': 'parent_path',
                    'recursion': 'recursion',
                    'page': 'page',
                    'num': 'num',
                    'order': 'order',
                    'desc': 'desc',
                    'web': 'web',
                },
                'location_map': {
                    'access_token': 'query',
                    'parent_path': 'query',
                    'recursion': 'query',
                    'page': 'query',
                    'num': 'query',
                    'order': 'query',
                    'desc': 'query',
                    'web': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json; charset=UTF-8'
                ],
                'content_type': [],
            },
            api_client=api_client
        )
        self.xpanfileimagelist_endpoint = _Endpoint(
            settings={
                'response_type': (dict,),
                'auth': [],
                'endpoint_path': '/rest/2.0/xpan/file?method=imagelist&openapi=xpansdk',
                'operation_id': 'xpanfileimagelist',
                'http_method': 'GET',
                'servers': [
                    {
                        'url': "https://pan.baidu.com",
                        'description': "No description provided",
                    },
                ]
            },
            params_map={
                'all': [
                    'access_token',
                    'parent_path',
                    'recursion',
                    'page',
                    'num',
                    'order',
                    'desc',
                    'web',
                ],
                'required': [
                    'access_token',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'access_token':
                        (str,),
                    'parent_path':
                        (str,),
                    'recursion':
                        (str,),
                    'page':
                        (int,),
                    'num':
                        (int,),
                    'order':
                        (str,),
                    'desc':
                        (str,),
                    'web':
                        (str,),
                },
                'attribute_map': {
                    'access_token': 'access_token',
                    'parent_path': 'parent_path',
                    'recursion': 'recursion',
                    'page': 'page',
                    'num': 'num',
                    'order': 'order',
                    'desc': 'desc',
                    'web': 'web',
                },
                'location_map': {
                    'access_token': 'query',
                    'parent_path': 'query',
                    'recursion': 'query',
                    'page': 'query',
                    'num': 'query',
                    'order': 'query',
                    'desc': 'query',
                    'web': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json; charset=UTF-8'
                ],
                'content_type': [],
            },
            api_client=api_client
        )
        self.xpanfilelist_endpoint = _Endpoint(
            settings={
                'response_type': (dict,),
                'auth': [],
                'endpoint_path': '/rest/2.0/xpan/file?method=list&openapi=xpansdk',
                'operation_id': 'xpanfilelist',
                'http_method': 'GET',
                'servers': [
                    {
                        'url': "https://pan.baidu.com",
                        'description': "No description provided",
                    },
                ]
            },
            params_map={
                'all': [
                    'access_token',
                    'dir',
                    'folder',
                    'start',
                    'limit',
                    'order',
                    'desc',
                    'web',
                    'showempty',
                ],
                'required': [
                    'access_token',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'access_token':
                        (str,),
                    'dir':
                        (str,),
                    'folder':
                        (str,),
                    'start':
                        (str,),
                    'limit':
                        (int,),
                    'order':
                        (str,),
                    'desc':
                        (int,),
                    'web':
                        (str,),
                    'showempty':
                        (int,),
                },
                'attribute_map': {
                    'access_token': 'access_token',
                    'dir': 'dir',
                    'folder': 'folder',
                    'start': 'start',
                    'limit': 'limit',
                    'order': 'order',
                    'desc': 'desc',
                    'web': 'web',
                    'showempty': 'showempty',
                },
                'location_map': {
                    'access_token': 'query',
                    'dir': 'query',
                    'folder': 'query',
                    'start': 'query',
                    'limit': 'query',
                    'order': 'query',
                    'desc': 'query',
                    'web': 'query',
                    'showempty': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json; charset=UTF-8'
                ],
                'content_type': [],
            },
            api_client=api_client
        )
        self.xpanfilesearch_endpoint = _Endpoint(
            settings={
                'response_type': (dict,),
                'auth': [],
                'endpoint_path': '/rest/2.0/xpan/file?method=search&openapi=xpansdk',
                'operation_id': 'xpanfilesearch',
                'http_method': 'GET',
                'servers': [
                    {
                        'url': "https://pan.baidu.com",
                        'description': "No description provided",
                    },
                ]
            },
            params_map={
                'all': [
                    'access_token',
                    'key',
                    'web',
                    'num',
                    'page',
                    'dir',
                    'recursion',
                ],
                'required': [
                    'access_token',
                    'key',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'access_token':
                        (str,),
                    'key':
                        (str,),
                    'web':
                        (str,),
                    'num':
                        (str,),
                    'page':
                        (str,),
                    'dir':
                        (str,),
                    'recursion':
                        (str,),
                },
                'attribute_map': {
                    'access_token': 'access_token',
                    'key': 'key',
                    'web': 'web',
                    'num': 'num',
                    'page': 'page',
                    'dir': 'dir',
                    'recursion': 'recursion',
                },
                'location_map': {
                    'access_token': 'query',
                    'key': 'query',
                    'web': 'query',
                    'num': 'query',
                    'page': 'query',
                    'dir': 'query',
                    'recursion': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json; charset=UTF-8'
                ],
                'content_type': [],
            },
            api_client=api_client
        )

    def xpanfiledoclist(
        self,
        access_token,
        **kwargs
    ):
        """xpanfiledoclist  # noqa: E501

        file doclist  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.xpanfiledoclist(access_token, async_req=True)
        >>> result = thread.get()

        Args:
            access_token (str):

        Keyword Args:
            parent_path (str): [optional]
            recursion (str): [optional]
            page (int): [optional]
            num (int): [optional]
            order (str): [optional]
            desc (str): [optional]
            web (str): [optional]
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            async_req (bool): execute request asynchronously

        Returns:
            str
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['access_token'] = \
            access_token
        return self.xpanfiledoclist_endpoint.call_with_http_info(**kwargs)

    def xpanfileimagelist(
        self,
        access_token,
        **kwargs
    ):
        """xpanfileimagelist  # noqa: E501

        file imagelist  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.xpanfileimagelist(access_token, async_req=True)
        >>> result = thread.get()

        Args:
            access_token (str):

        Keyword Args:
            parent_path (str): [optional]
            recursion (str): [optional]
            page (int): [optional]
            num (int): [optional]
            order (str): [optional]
            desc (str): [optional]
            web (str): [optional]
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            async_req (bool): execute request asynchronously

        Returns:
            str
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['access_token'] = \
            access_token
        return self.xpanfileimagelist_endpoint.call_with_http_info(**kwargs)

    def xpanfilelist(
        self,
        access_token,
        **kwargs
    ):
        """xpanfilelist  # noqa: E501

        file list  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.xpanfilelist(access_token, async_req=True)
        >>> result = thread.get()

        Args:
            access_token (str):

        Keyword Args:
            dir (str): [optional]
            folder (str): [optional]
            start (str): [optional]
            limit (int): [optional]
            order (str): [optional]
            desc (int): [optional]
            web (str): [optional]
            showempty (int): [optional]
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            async_req (bool): execute request asynchronously

        Returns:
            str
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['access_token'] = \
            access_token
        return self.xpanfilelist_endpoint.call_with_http_info(**kwargs)

    def xpanfilesearch(
        self,
        access_token,
        key,
        **kwargs
    ):
        """xpanfilesearch  # noqa: E501

        file search  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.xpanfilesearch(access_token, key, async_req=True)
        >>> result = thread.get()

        Args:
            access_token (str):
            key (str):

        Keyword Args:
            web (str): [optional]
            num (str): [optional]
            page (str): [optional]
            dir (str): [optional]
            recursion (str): [optional]
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            async_req (bool): execute request asynchronously

        Returns:
            str
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['access_token'] = \
            access_token
        kwargs['key'] = \
            key
        return self.xpanfilesearch_endpoint.call_with_http_info(**kwargs)



path: server/openapi_client/api/fileupload_api.py
content: """
    xpan

    xpanapi  # noqa: E501

    The version of the OpenAPI document: 0.1
    Generated by: https://openapi-generator.tech
"""


import re  # noqa: F401
import sys  # noqa: F401

from openapi_client.api_client import ApiClient, Endpoint as _Endpoint
from openapi_client.model_utils import (  # noqa: F401
    check_allowed_values,
    check_validations,
    date,
    datetime,
    file_type,
    none_type,
    validate_and_convert_types
)
# from openapi_client.model.filecreateresponse import Filecreateresponse
# from openapi_client.model.fileprecreateresponse import Fileprecreateresponse


class FileuploadApi(object):
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client
        self.pcssuperfile2_endpoint = _Endpoint(
            settings={
                'response_type': (dict,),
                'auth': [],
                'endpoint_path': '/rest/2.0/pcs/superfile2?method=upload&openapi=xpansdk',
                'operation_id': 'pcssuperfile2',
                'http_method': 'POST',
                'servers': [
                    {
                        'url': "https://d.pcs.baidu.com",
                        'description': "No description provided",
                    },
                ]
            },
            params_map={
                'all': [
                    'access_token',
                    'partseq',
                    'path',
                    'uploadid',
                    'type',
                    'file',
                ],
                'required': [
                    'access_token',
                    'partseq',
                    'path',
                    'uploadid',
                    'type',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'access_token':
                        (str,),
                    'partseq':
                        (str,),
                    'path':
                        (str,),
                    'uploadid':
                        (str,),
                    'type':
                        (str,),
                    'file':
                        (file_type,),
                },
                'attribute_map': {
                    'access_token': 'access_token',
                    'partseq': 'partseq',
                    'path': 'path',
                    'uploadid': 'uploadid',
                    'type': 'type',
                    'file': 'file',
                },
                'location_map': {
                    'access_token': 'query',
                    'partseq': 'query',
                    'path': 'query',
                    'uploadid': 'query',
                    'type': 'query',
                    'file': 'form',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'text/html;charset=utf8'
                ],
                'content_type': [
                    'multipart/form-data'
                ]
            },
            api_client=api_client
        )
        self.xpanfilecreate_endpoint = _Endpoint(
            settings={
                'response_type': (dict,),
                'auth': [],
                'endpoint_path': '/rest/2.0/xpan/file?method=create&openapi=xpansdk',
                'operation_id': 'xpanfilecreate',
                'http_method': 'POST',
                'servers': [
                    {
                        'url': "https://pan.baidu.com",
                        'description': "No description provided",
                    },
                ]
            },
            params_map={
                'all': [
                    'access_token',
                    'path',
                    'isdir',
                    'size',
                    'uploadid',
                    'block_list',
                    'rtype',
                ],
                'required': [
                    'access_token',
                    'path',
                    'isdir',
                    'size',
                    'uploadid',
                    'block_list',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'access_token':
                        (str,),
                    'path':
                        (str,),
                    'isdir':
                        (int,),
                    'size':
                        (int,),
                    'uploadid':
                        (str,),
                    'block_list':
                        (str,),
                    'rtype':
                        (int,),
                },
                'attribute_map': {
                    'access_token': 'access_token',
                    'path': 'path',
                    'isdir': 'isdir',
                    'size': 'size',
                    'uploadid': 'uploadid',
                    'block_list': 'block_list',
                    'rtype': 'rtype',
                },
                'location_map': {
                    'access_token': 'query',
                    'path': 'form',
                    'isdir': 'form',
                    'size': 'form',
                    'uploadid': 'form',
                    'block_list': 'form',
                    'rtype': 'form',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json; charset=UTF-8'
                ],
                'content_type': [
                    'application/x-www-form-urlencoded'
                ]
            },
            api_client=api_client
        )
        self.xpanfileprecreate_endpoint = _Endpoint(
            settings={
                'response_type': (dict,),
                'auth': [],
                'endpoint_path': '/rest/2.0/xpan/file?method=precreate&openapi=xpansdk',
                'operation_id': 'xpanfileprecreate',
                'http_method': 'POST',
                'servers': [
                    {
                        'url': "https://pan.baidu.com",
                        'description': "No description provided",
                    },
                ]
            },
            params_map={
                'all': [
                    'access_token',
                    'path',
                    'isdir',
                    'size',
                    'autoinit',
                    'block_list',
                    'rtype',
                ],
                'required': [
                    'access_token',
                    'path',
                    'isdir',
                    'size',
                    'autoinit',
                    'block_list',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'access_token':
                        (str,),
                    'path':
                        (str,),
                    'isdir':
                        (int,),
                    'size':
                        (int,),
                    'autoinit':
                        (int,),
                    'block_list':
                        (str,),
                    'rtype':
                        (int,),
                },
                'attribute_map': {
                    'access_token': 'access_token',
                    'path': 'path',
                    'isdir': 'isdir',
                    'size': 'size',
                    'autoinit': 'autoinit',
                    'block_list': 'block_list',
                    'rtype': 'rtype',
                },
                'location_map': {
                    'access_token': 'query',
                    'path': 'form',
                    'isdir': 'form',
                    'size': 'form',
                    'autoinit': 'form',
                    'block_list': 'form',
                    'rtype': 'form',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json; charset=UTF-8'
                ],
                'content_type': [
                    'application/x-www-form-urlencoded'
                ]
            },
            api_client=api_client
        )

    def pcssuperfile2(
        self,
        access_token,
        partseq,
        path,
        uploadid,
        type,
        **kwargs
    ):
        """pcssuperfile2  # noqa: E501

        分片上传，这里是实际的文件内容传送部分。一般多为大于4MB的文件，需将文件以4MB为单位切分，对切分后得到的n个分片一一调用该接口进行传送，以实现对原文件的传送（当然若不大于4MB，则直接该对文件进行传送即可）。  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.pcssuperfile2(access_token, partseq, path, uploadid, type, async_req=True)
        >>> result = thread.get()

        Args:
            access_token (str):
            partseq (str):
            path (str):
            uploadid (str):
            type (str):

        Keyword Args:
            file (file_type): 要进行传送的本地文件分片. [optional]
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            async_req (bool): execute request asynchronously

        Returns:
            str
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['access_token'] = \
            access_token
        kwargs['partseq'] = \
            partseq
        kwargs['path'] = \
            path
        kwargs['uploadid'] = \
            uploadid
        kwargs['type'] = \
            type
        return self.pcssuperfile2_endpoint.call_with_http_info(**kwargs)

    def xpanfilecreate(
        self,
        access_token,
        path,
        isdir,
        size,
        uploadid,
        block_list,
        **kwargs
    ):
        """xpanfilecreate  # noqa: E501

        将多个文件分片合并成一个文件，生成文件基本信息，完成文件的上传最后一步。  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.xpanfilecreate(access_token, path, isdir, size, uploadid, block_list, async_req=True)
        >>> result = thread.get()

        Args:
            access_token (str):
            path (str): 与precreate的path值保持一致
            isdir (int): isdir
            size (int): 与precreate的size值保持一致
            uploadid (str): precreate返回的uploadid
            block_list (str): 与precreate的block_list值保持一致

        Keyword Args:
            rtype (int): rtype. [optional]
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            async_req (bool): execute request asynchronously

        Returns:
            Filecreateresponse
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['access_token'] = \
            access_token
        kwargs['path'] = \
            path
        kwargs['isdir'] = \
            isdir
        kwargs['size'] = \
            size
        kwargs['uploadid'] = \
            uploadid
        kwargs['block_list'] = \
            block_list
        return self.xpanfilecreate_endpoint.call_with_http_info(**kwargs)

    def xpanfileprecreate(
        self,
        access_token,
        path,
        isdir,
        size,
        autoinit,
        block_list,
        **kwargs
    ):
        """xpanfileprecreate  # noqa: E501

        文件预上传，用于获取上传任务id，既uploadid  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.xpanfileprecreate(access_token, path, isdir, size, autoinit, block_list, async_req=True)
        >>> result = thread.get()

        Args:
            access_token (str):
            path (str): 对于一般的第三方软件应用，路径以 \\\"/apps/your-app-name/\\\" 开头。对于小度等硬件应用，路径一般 \\\"/来自：小度设备/\\\" 开头。对于定制化配置的硬件应用，根据配置情况进行填写。
            isdir (int): isdir
            size (int): size
            autoinit (int): autoinit
            block_list (str): 由MD5字符串组成的list

        Keyword Args:
            rtype (int): rtype. [optional]
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            async_req (bool): execute request asynchronously

        Returns:
            Fileprecreateresponse
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['access_token'] = \
            access_token
        kwargs['path'] = \
            path
        kwargs['isdir'] = \
            isdir
        kwargs['size'] = \
            size
        kwargs['autoinit'] = \
            autoinit
        kwargs['block_list'] = \
            block_list
        return self.xpanfileprecreate_endpoint.call_with_http_info(**kwargs)



path: server/openapi_client/model/__init__.py
content: # we can not import model classes here because that would create a circular
# reference which would not work in python2
# do not import all models into this module because that uses a lot of memory and stack frames
# if you need the ability to import all models from one package, import them with
# from {{packageName}.models import ModelA, ModelB


path: server/pyproject.toml
content: [project]
name = "baidudisk-mcp-server"
version = "0.1.0"
description = "Baidu Netdisk MCP stdio server with hot-reload token file"
requires-python = ">=3.10"
dependencies = [
    "mcp[cli]>=1.6.0",
    "python-dateutil>=2.9.0.post0",
    "urllib3>=1.25.3",
    "requests>=2.31.0",
]


path: server/selfcheck_normalize_fsids.py
content: #!/usr/bin/env python3
"""Token-free selfcheck for fsids normalization path."""

from netdisk import _normalize_fsids


if __name__ == "__main__":
    normalized = _normalize_fsids([1, 2])
    assert normalized == [1, 2], normalized
    print("selfcheck ok: _normalize_fsids([1, 2]) ->", normalized)


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (CRITICAL)