Skip to content

Commit

Permalink
v1.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwickerhf committed Oct 29, 2020
1 parent 516d412 commit 73ec8c3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
20 changes: 19 additions & 1 deletion instaclient/client/instaclient.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""This module contains the InstaClient class"""
from selenium import webdriver
from selenium.webdriver.remote.webelement import WebElement
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support.wait import WebDriverWait, wait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import NoSuchElementException, TimeoutException
Expand Down Expand Up @@ -198,6 +198,24 @@ def resend_security_code(self):
resend_btn = self.__find_element(EC.presence_of_element_located((By.XPATH, Paths.RESEND_CODE_BTN)), wait_time=4)
resend_btn.click()

alert = self.__check_existence(EC.presence_of_element_located((By.XPATH, Paths.ERROR_SENDING_CODE)), wait_time=3)
if alert:
back_btn = self.__find_element(EC.presence_of_element_located((By.XPATH, Paths.BACK_BTN)), wait_time=4)
back_btn.click()
time.sleep(1)
email = self.__find_element(EC.presence_of_element_located((By.XPATH, Paths.SELECT_EMAIL_BTN)), wait_time=4)
email.click()
time.sleep(0.5)
send_btn = self.__find_element(EC.presence_of_element_located((By.XPATH, Paths.SEND_CODE)), wait_time=4)
send_btn.click()
mode = SuspisciousLoginAttemptError.EMAIL
raise SuspisciousLoginAttemptError(mode)
raise SuspisciousLoginAttemptError()
else:
print('Wrong Url when resending code')
return False


@insta_method
def input_security_code(self, code:int or str):
code = str(code)
Expand Down
1 change: 1 addition & 0 deletions instaclient/client/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Paths:
ERROR_SENDING_CODE = '//div[@class="_3_2jD" and @id="form_error"]//descendant::p'
RESEND_CODE_BTN = '//p[@class="GusmU t_gv9 "]//descendant::a'
SELECT_EMAIL_BTN = '//label[@class="UuB0U " and @for="choice_1"]//descendant::div'
BACK_BTN = '//svg[@class="_8-yf5 "]'
# 2FA Verification
VERIFICATION_CODE = '//input[@name="verificationCode"]'
SECURITY_CODE_BTN = '//button[@class="sqdOP L3NKy y3zKF "]'
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
setup(
name = 'instaclient', # How you named your package folder (MyLib)
packages = find_packages(exclude=['tests']), # Chose the same as "name"
version = '1.7.1', # Start with a small number and increase it with every change you make
version = '1.7.2', # Start with a small number and increase it with every change you make
license='MIT', # Chose a license from here: https://help.github.com/articles/licensing-a-repository
description = 'Instagram client built with Python 3.8 and the Selenium package.',
long_description=README,
long_description_content_type="text/markdown",
author = 'David Wicker', # Type in your name
author_email = '[email protected]', # Type in your E-Mail
url = 'https://github.com/wickerdevs/py-instaclient', # Provide either the link to your github or to your website
download_url = 'https://github.com/wickerdevs/py-instaclient/archive/v1.7.1.tar.gz', # I explain this later on
download_url = 'https://github.com/wickerdevs/py-instaclient/archive/v1.7.2.tar.gz', # I explain this later on
keywords = ['INSTAGRAM', 'BOT', 'INSTAGRAM BOT', 'INSTAGRAM CLIENT'], # Keywords that define your package best
install_requires=[ # I get to this in a second
'selenium',
Expand Down

0 comments on commit 73ec8c3

Please sign in to comment.