-
Open a browser
# start an instance of firefox with selenium-webdriver driver = Selenium::WebDriver.for :firefox # :chrome -> chrome # :ie -> iexplore
- Go to a specified URL
| # Install chromedriver from https://sites.google.com/a/chromium.org/chromedriver/downloads | |
| import os | |
| from optparse import OptionParser | |
| from selenium import webdriver | |
| from selenium.webdriver.chrome.options import Options | |
| CHROME_PATH = '/usr/bin/google-chrome' |
| # Import unittest module for creating unit tests | |
| import unittest | |
| # Import time module to implement | |
| import time | |
| # Import the Selenium 2 module (aka "webdriver") | |
| from selenium import webdriver | |
| # For automating data input |
| #!/usr/bin/env bash | |
| # https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/ | |
| # https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c | |
| # http://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver | |
| # http://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception | |
| # http://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal | |
| # http://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04 | |
| # Versions | |
| CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE` |
| from selenium import webdriver | |
| from selenium.webdriver.common.keys import Keys | |
| from bs4 import BeautifulSoup | |
| import re | |
| import pandas as pd | |
| from tabulate import tabulate | |
| import os | |
| #launch url | |
| url = "http://kanview.ks.gov/PayRates/PayRates_Agency.aspx" |
| # List unique values in a DataFrame column | |
| # h/t @makmanalp for the updated syntax! | |
| df['Column Name'].unique() | |
| # Convert Series datatype to numeric (will error if column has non-numeric values) | |
| # h/t @makmanalp | |
| pd.to_numeric(df['Column Name']) | |
| # Convert Series datatype to numeric, changing non-numeric values to NaN | |
| # h/t @makmanalp for the updated syntax! |
| # Compiled source # | |
| ################### | |
| *.com | |
| *.class | |
| *.dll | |
| *.exe | |
| *.o | |
| *.so | |
| # Packages # |
| # uses the date_to_milliseconds and interval_to_milliseconds functions | |
| # https://gist.github.com/sammchardy/3547cfab1faf78e385b3fcb83ad86395 | |
| # https://gist.github.com/sammchardy/fcbb2b836d1f694f39bddd569d1c16fe | |
| from binance.client import Client | |
| import time | |
| def get_historical_klines(symbol, interval, start_str, end_str=None): | |
| """Get Historical Klines from Binance |
| def interval_to_milliseconds(interval): | |
| """Convert a Binance interval string to milliseconds | |
| :param interval: Binance interval string 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w | |
| :type interval: str | |
| :return: | |
| None if unit not one of m, h, d or w | |
| None if string not in correct format | |
| int value of interval in milliseconds |