Skip to content

API List

Note

🟢 Indicates implemented, 🟡 Indicates in progress or being modified, 🟤 Indicates temporarily not implemented, 🔵 Indicates possible future implementation, 🔴 Indicates deprecation.

Handler API List
CLI APIMethod
(GET) Send notificationfetch_bark_notification
(POST) Send notificationpost_bark_notification
(Cipher) Send notificationcipher_bark_notification
Data Method APIMethodDeveloper API
Quick Notificationsend_quick_notification🟢
Utils API List
Utility APIClass NameMethodStatus
Manage Client ConfigurationClientConfManager-🟢
Generate Random Numeric Bytes-generate_numeric_bytes🟢
Crawler API List
Crawler URL APIClass NameMethodStatus
(GET) Bark Notification APIBarkCrawlerfetch_bark_notification🟢
(POST) Bark Notification APIBarkCrawlerpost_bark_notification🟢
(CIPHER) Bark Notification APIBarkCrawlercipher_bark_notification🟢

💡 Note

  • Bark is an integrated iOS notification push tool in F2, used to push task execution results to iOS devices. It can also send notifications via CLI mode. CLI Guide
  • Bark's GCM push encryption mode is still in the experimental stage. It is recommended to use AES-256-CBC encryption mode for now.

handler API List

Quick Notification 🟢

Asynchronous method for sending quick notifications.

ParameterTypeDescription
titlestrNotification title
bodystrNotification content
send_methodstrSending method, options: GET, POST
ReturnTypeDescription
BarkNotificationFiltermodelNotification filter containing _to_raw, _to_dict methods
py
import asyncio
from f2.apps.bark.handler import BarkHandler
from f2.log.logger import logger


kwargs = {
    "key": "YOUR_BARK_KEY_HERE",
    "send_method": "fetch",
    "proxies": {"http://": None, "https://": None},
    "timeout": 10,
}


async def main():
    bark = await BarkHandler(kwargs).send_quick_notification("Hello", "World")

    if not bark:
        logger.error("Bark 通知发送失败,未收到响应")
        return

    logger.info("=================_to_raw================")
    logger.info(bark._to_raw())
    # logger.info("=================_to_dict===============")
    # logger.info(bark._to_dict())


if __name__ == "__main__":
    asyncio.run(main())

utils API List

Manage Client Configuration 🟢

Used for managing client configuration.

ParameterTypeDescription
NoneNoneNone
ReturnTypeDescription
Config file valueAnyConfiguration file value
py
from f2.apps.bark.utils import ClientConfManager

if __name__ == "__main__":
    print("Client Configuration:")
    print(ClientConfManager.client())

    print("Client Configuration version:")
    print(ClientConfManager.conf_version())

    print("Client Configuration user-agent:")
    print(ClientConfManager.user_agent())

Generate Random Numeric Bytes 🟢

Used to generate random numeric bytes.

ParameterTypeDescription
lengthintByte length
ReturnTypeDescription
numeric_strbytesRandom bytes
py
from f2.apps.bark.utils import generate_numeric_bytes
from f2.log.logger import logger

if __name__ == "__main__":
    length = 10
    logger.info(
        f"生成的字节长度为 {length} 的纯数字字节: {generate_numeric_bytes(length)}"
    )

crawler API List

Bark Notification API (GET) 🟢

Asynchronous method for sending Bark notifications.

ParameterTypeDescription
paramsBarkModelAPI parameter model
ReturnTypeDescription
_fetch_get_jsondictReturn value after sending

Bark Notification API (POST) 🟢

Asynchronous method for sending Bark notifications using POST.

ParameterTypeDescription
paramsBarkModelAPI parameter model
ReturnTypeDescription
_fetch_post_jsondictReturn value after sending

Bark Notification API (CIPHER) 🟢

Asynchronous method for sending encrypted Bark notifications.

ParameterTypeDescription
paramsBarkCipherModelAPI parameter model
ReturnTypeDescription
_fetch_post_jsondictReturn value after sending

Released under the Apache-2.0 license.