I am trying to login to instagram.Here is my code
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)
unfortunately it doesn't seem to log me in. I get:
lt-ie8 lt-ie7 not-logged-in client-root
Any solutions would be much appreciated. Thanks.
You can now schedule your instagram posts programmatically without relying on limiting and expensive apps like Hootsuite and Later. You can create your own code to post to instagram up to 25 posts a day using the Instagram Graph API.
To send Instagram message using Python, you need to have an Instagram account and the instabot library installed in your Python virtual environment. Instabot is a Python library that you can use to automate features of your Instagram account using Python, like sending messages without even opening your application.
you can get idea to implement this from here
Logging to Instagram using Python requests
my code for login to instagram
import pdb
from selenium import webdriver
driver = webdriver.PhantomJS()
driver.get('https://www.instagram.com/accounts/login/')
dom = driver.find_element_by_xpath('//*')
pdb.set_trace()
username = dom.find_element_by_name('username')
password = dom.find_element_by_name('password')
login_button = dom.find_element_by_xpath('//*[@class="_qv64e _gexxb _4tgw8 _njrw0"]')
username.clear()
password.clear()
username.send_keys('your username')
password.send_keys('your password')
login_button.click()
driver.get('https://www.instagram.com/accounts/login')
if 'logged-in' in driver.page_source:
print 'Logged in'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With