url = "http://api.baidu.com/test-files/testFiles/1234/%E9%97%AE%E9%A2%98%E5%8D%95%E6%97%B6%E6%95%88-%E8%B7%9F%E8%BF%9B_2020-04-02%2000%3A00%3A00_2020-04-08%2000%3A00%3A00_5675.xlsx.zip"
def delete_url1(url):
r = requests.delete(url)
print(f"requests 模块请求地址为:{r.url}")
delete_url1(url)
print()
async def delete_url2(url):
async with aiohttp.ClientSession() as session:
async with session.delete(url) as resp:
print(f"aiohttp 模块请求地址为:{resp.url}")
asyncio.run(delete_url2(url))
执行结果:
requests 模块请求地址为: http://api.baidu.com/test-files/testFiles/1234/%E9%97%AE%E9%A2%98%E5%8D%95%E6%97%B6%E6%95%88-%E8%B7%9F%E8%BF%9B_2020-04-02%2000%3A00%3A00_2020-04-08%2000%3A00%3A00_5675.xlsx.zip
aiohttp 模块请求地址为: http://api.baidu.com/test-files/testFiles/1234/%E9%97%AE%E9%A2%98%E5%8D%95%E6%97%B6%E6%95%88-%E8%B7%9F%E8%BF%9B_2020-04-02%2000:00:00_2020-04-08%2000:00:00_5675.xlsx.zip