first commit
This commit is contained in:
@@ -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())
|
||||
@@ -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()
|
||||
@@ -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()
|
||||
@@ -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)
|
||||
Reference in New Issue
Block a user