first commit

This commit is contained in:
jack
2025-11-12 15:56:25 +08:00
commit 2c0019254d
108 changed files with 51129 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
import httpx
import asyncio
async def async_get_example():
async with httpx.AsyncClient() as client:
response = await client.get('https://httpbin.org/get')
print(f"Status Code: {response.status_code}")
print(f"Response Content: {response.text}")
async def main():
await async_get_example()
if __name__ == "__main__":
asyncio.run(main())
+14
View File
@@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
import httpx
def sync_get_example():
# 使用 httpx 发送 GET 请求
response = httpx.get('https://httpbin.org/get')
# 打印状态码和响应内容
print(f"Status Code: {response.status_code}")
print(f"Response Content: {response.text}")
if __name__ == "__main__":
sync_get_example()
+9
View File
@@ -0,0 +1,9 @@
# -*- coding: utf-8 -*-
from playwright.sync_api import sync_playwright
with sync_playwright() as playwright:
browser = playwright.chromium.launch(headless=False)
page = browser.new_page()
page.goto('https://example.com')
page.screenshot(path='example.png')
browser.close()
+20
View File
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
import subprocess
token = 'AdVsmticWy_cnF6'
title = '测试标题'
message = '这是一条通过 Webhook 推送的消息'
priority = 5
# 推送消息
result = subprocess.run(['curl',
f'https://gotify.erhe.top/message?token={token}',
'-F',
f'title={title}',
'-F',
f'message={message}',
'-F',
f'priority={priority}'
])
print(result)