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 API | Method |
---|---|
(GET) Send notification | fetch_bark_notification |
(POST) Send notification | post_bark_notification |
(Cipher) Send notification | cipher_bark_notification |
Data Method API | Method | Developer API |
---|---|---|
Quick Notification | send_quick_notification | 🟢 |
Utils API List
Utility API | Class Name | Method | Status |
---|---|---|---|
Manage Client Configuration | ClientConfManager | - | 🟢 |
Generate Random Numeric Bytes | - | generate_numeric_bytes | 🟢 |
Crawler API List
Crawler URL API | Class Name | Method | Status |
---|---|---|---|
(GET) Bark Notification API | BarkCrawler | fetch_bark_notification | 🟢 |
(POST) Bark Notification API | BarkCrawler | post_bark_notification | 🟢 |
(CIPHER) Bark Notification API | BarkCrawler | cipher_bark_notification | 🟢 |
💡 Note
Bark
is an integratediOS
notification push tool inF2
, used to push task execution results toiOS
devices. It can also send notifications viaCLI
mode. CLI GuideBark
'sGCM
push encryption mode is still in the experimental stage. It is recommended to useAES-256-CBC
encryption mode for now.
handler API List
Quick Notification 🟢
Asynchronous method for sending quick notifications.
Parameter | Type | Description |
---|---|---|
title | str | Notification title |
body | str | Notification content |
send_method | str | Sending method, options: GET , POST |
Return | Type | Description |
---|---|---|
BarkNotificationFilter | model | Notification 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.
Parameter | Type | Description |
---|---|---|
None | None | None |
Return | Type | Description |
---|---|---|
Config file value | Any | Configuration 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.
Parameter | Type | Description |
---|---|---|
length | int | Byte length |
Return | Type | Description |
---|---|---|
numeric_str | bytes | Random 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.
Parameter | Type | Description |
---|---|---|
params | BarkModel | API parameter model |
Return | Type | Description |
---|---|---|
_fetch_get_json | dict | Return value after sending |
Bark Notification API (POST) 🟢
Asynchronous method for sending Bark
notifications using POST
.
Parameter | Type | Description |
---|---|---|
params | BarkModel | API parameter model |
Return | Type | Description |
---|---|---|
_fetch_post_json | dict | Return value after sending |
Bark Notification API (CIPHER) 🟢
Asynchronous method for sending encrypted Bark
notifications.
Parameter | Type | Description |
---|---|---|
params | BarkCipherModel | API parameter model |
Return | Type | Description |
---|---|---|
_fetch_post_json | dict | Return value after sending |