client_id = "XXXXXX"
secret_key = "XXXXXX"
redirect_uri="[http://localhost:5000](http://localhost:5000)"
response_type="code"
grant_type="authorization_code"
app_session = accessToken.SessionModel(client_id=client_id,secret_key=secret_key,redirect_uri=redirect_uri,response_type=response_type, grant_type=grant_type)
response = app_session.generate_authcode()
driver = [webdriver.Chrome](http://webdriver.Chrome)("YYYYYY")
driver.get(response)
time.sleep(5)
driver.find_element_by_xpath('//*[@id="fyers_id"]').send_keys("XXXXXX")
driver.find_element_by_xpath('//*[@id="password"]').send_keys("XXXXXX")
driver.find_element_by_xpath('//*[@id="pancard"]').send_keys("XXXXXX")
driver.find_element_by_xpath('//*[@id="btn_id"]').click()
time.sleep(10)
start = driver.current_url.find('auth_code=')+10
end = driver.current_url.find('&state=None', start)
auth_code=driver.current_url[start:end]
app_session.set_token(auth_code)
response = app_session.generate_token()
access_token = response["access_token"]
is_async = False #(By default the async will be False, Change to True for async API calls.)
fyers = fyersModel.FyersModel(client_id=client_id, token=access_token, log_path="/Users/vishnubharath/Desktop/Fyerslogs")
driver.quit()
Dependencies are:
import fyers_api
import selenium
from selenium import webdriver
from fyers_api import accessToken
from fyers_api import fyersModel
ALL the XXXXXX are to be input by you. The YYYYYY is also to be input by you and that is the location on chromedriver on your system.