我想用服务器调用instagram api。
我尝试在本地系统上执行以下操作:
curl https://api.coingecko.com/api/v3/coins/list -->works perfectly
curl https://www.instagram.com/zitate.flx/?__a=1 -->works perfectly
在Linux服务器上:
curl https://api.coingecko.com/api/v3/coins/list -->works perfectly
curl https://www.instagram.com/zitate.flx/?__a=1 -->doesn't work
我的问题:为什么对instagram API的请求在我的本地系统上有效但在服务器上不起作用?
答案 0 :(得分:0)
import requests
def create_session():
cookie = {"name": "sessionid", "value":"{this is your session id}"}
session = requests.Session()
session.cookies.set(**cookie)
return session
s = create_session()
response = s.get(https://www.instagram.com/zitate.flx/?__a=1)