Skip to content

Instantly share code, notes, and snippets.

@0xrushi
Last active January 9, 2020 03:33
Show Gist options
  • Save 0xrushi/4d54595292288e9b29b7745b19103235 to your computer and use it in GitHub Desktop.
Save 0xrushi/4d54595292288e9b29b7745b19103235 to your computer and use it in GitHub Desktop.
A small script to fetch current HDFC bank forex rates, to reload their forex card. This makes checking rates everyday on our phones easier.
import tabula
from selenium import webdriver
url = 'https://v1.hdfcbank.com/assets/pdf/forex_rates/rates.pdf'
download_dir = "./" # for linux/*nix, download_dir="/usr/Public"
options = webdriver.ChromeOptions()
options.add_experimental_option('prefs', {
"download.default_directory": download_dir, #Change default directory for downloads
"download.prompt_for_download": False, #To auto download the file
"download.directory_upgrade": True,
"plugins.always_open_pdf_externally": True #It will not show PDF directly in chrome
})
options.add_argument('--headless')
driver = webdriver.Chrome(chrome_options=options) # Optional argument, if not specified will search path.
driver.get(url)
df = tabula.read_pdf(download_dir+'rates.pdf')
print(df.iloc[20,9])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment