I'm trying to make an automation that will send the http requests to follow or unfollow a user through an instagram api, right now I'm using the Python Requests module and Im trying to do it through the site 'http://pikore.com'. My current code is is :
import requests
from requests.auth import HTTPBasicAuth
s = requests.Session()
s.get('http://pikore.com')
print(s.cookies)
s.get('http://www.pikore.com/session/new?from=%2F', auth=HTTPBasicAuth('USERNAME', 'USERSECRET'))
pikore_session = s.cookies['_pikore_session']
print(s.cookies)
s.get('http://pikore.com')
print(s.cookies)
cookies = {
'_pikore_session': pikore_session,
'token': 'BAhJIjcyNTY5NDczOTIuZWIxM2FlYi41Mjc3ZTI4NjI4ZDM0NDRl

使用Python Requests模块进行自动化时,遇到问题:在通过Instagram API跟随或取消关注用户时,无法在重定向后获取'token' cookie。通过设置`allow_redirects=False`,然后手动处理302重定向,可以解决这个问题。在最后一个重定向响应中,可以获取到所需'token' cookie,避免每次手动获取。
最低0.47元/天 解锁文章
763

被折叠的 条评论
为什么被折叠?



