我们正在使用aiohttp向各种网站供应商发出多个请求以获取最新数据。
某些内容提供商从缓存中提供数据。是否可以直接从服务器请求数据?我们试图传递async def fetch(url):
global response
headers = {'Cache-Control': 'no-cache'}
async with ClientSession() as session:
async with session.get(url, headers=headers, proxy="OUR-PROXY") as response:
return await response.read()
参数而没有运气。
last-modified date header
目标是获取缓存请求未提供的{{1}}。
答案 0 :(得分:0)
尝试将一些具有动态值的其他变量添加到网址(例如时间戳记)。 即使它忽略Cache-Control,这也可以防止在服务器端进行缓存。
示例:
来自:https://example.com/test
到:https://example.com/test?timestamp=20180724181234