使用python登录Instagram

Kol*_*nko 6 python login beautifulsoup instagram web

我正在尝试登录 instagram。这是我的代码

from bs4 import BeautifulSoup
from requests import *
payload = {
    'action': 'login',
    'username': 'name',
    'password': 'pass'
}

with session() as c:
    c.post('https://www.instagram.com/login.php', data=payload)
    response = c.get('https://www.instagram.com/accounts/edit/')
    print(response.headers)
    print(response.text)
Run Code Online (Sandbox Code Playgroud)

不幸的是,它似乎没有让我登录。我得到:

lt-ie8 lt-ie7 not-logged-in client-root
Run Code Online (Sandbox Code Playgroud)

任何解决方案将不胜感激。谢谢。

小智 0

您需要一个 API 密钥才能调用 Instagram API,而且我认为您不能直接登录这样的人。