【发布时间】:2019-11-17 15:31:40
【问题描述】:
我的代码门控错误:
File "app.py", line 31
ed = TwitterBot('Someusername', 'Password@gmail.com')
^
IndentationError: unindent does not match any outer indentation level
i have install
pip- selenium
geckodriver
从硒导入网络驱动程序 从 selenium.webdriver.common.keys 导入密钥 进口时间
类 TwitterBot: def init(自我、用户名、密码): self.username = 用户名 self.password = 密码 self.bot = webdriver.Firefox()
def login(self):
bot = self.bot
bot.get('https://twitter.com/')
time.sleep(3)
email = bot.find_element_by_class_name('email-input')
password = bot.find_element_by_name('sesssion[password]')
email.clear()
password.clear()
email.send_keys(self.username)
password.send_keys(self.password)
password.send_keys(Keys.RETURN)
time.sleep(3)
def like_tweet(self, hashtag):
bot = self.bot
bot.get = (
'https://twitter.com/search?q=' + hashtag + '&src=typd')
time.sleep(3)
ed = TwitterBot('Someusername', 'Password@gmail.com') #some error
ed.login()
ed.like_tweet('webdevelopment')
【问题讨论】:
-
因为它没有。出于某种原因,您将最后 3 行每行缩进 1 个空格
标签: python selenium twitter bots