Compare commits

2 Commits
Author SHA1 Message Date
Sloetjes b70051c109 Fixed merge conflicts with sqlalchemy script 2023-05-31 17:55:35 -04:00
Sloetjes cb88499ac9 Fixed merge conflicts with NFL zip code script 2023-05-31 17:54:08 -04:00
2 changed files with 5 additions and 9 deletions
+5 -8
View File
@@ -8,7 +8,7 @@ from google.cloud import pubsub_v1
# In[2]: # In[2]:
# Set the project ID and topic name # Set the project ID and topic name
project_id = 'svig-384801' project_id = 'price-extraction-project'
topic_name = 'nfl-zipcodes' topic_name = 'nfl-zipcodes'
@@ -82,12 +82,12 @@ from selenium.webdriver.support import expected_conditions as EC
from google.cloud import pubsub_v1 from google.cloud import pubsub_v1
# Set the project ID and subscription name # Set the project ID and subscription name
project_id = 'svig-384801' project_id = 'price-extraction-project'
topic_name = 'nfl-zipcodes' topic_name = 'nfl-zipcodes'
subscription_name = 'nfl-zipcodes-sub' subscription_name = 'sloetjes'
# Set the path to your ChromeDriver executable # Set the path to your ChromeDriver executable
chrome_driver_path = "/usr/local/bin/chromedriver" chrome_driver_path = "/Users/sloetjeswong/Downloads/chromedriver_mac_arm64/chromedriver"
# Set up a Google Cloud Pub/Sub subscriber # Set up a Google Cloud Pub/Sub subscriber
subscriber = pubsub_v1.SubscriberClient() subscriber = pubsub_v1.SubscriberClient()
@@ -95,7 +95,7 @@ subscription_path = subscriber.subscription_path(project_id, subscription_name)
# Set up a ChromeDriver instance # Set up a ChromeDriver instance
chrome_options = webdriver.ChromeOptions() chrome_options = webdriver.ChromeOptions()
#chrome_options.add_argument("--headless") # Run Chrome in headless mode chrome_options.add_argument("--headless") # Run Chrome in headless mode
chrome_service = Service(chrome_driver_path) chrome_service = Service(chrome_driver_path)
chrome_service.start() chrome_service.start()
driver = webdriver.Remote(chrome_service.service_url, options=chrome_options) driver = webdriver.Remote(chrome_service.service_url, options=chrome_options)
@@ -111,7 +111,6 @@ def callback(message):
# Wait for the price to load # Wait for the price to load
price_xpath = "//span[@class='price']" price_xpath = "//span[@class='price']"
print(EC.presence_of_element_located((By.XPATH, price_xpath)))
price_element = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, price_xpath))) price_element = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, price_xpath)))
# Extract the price and print it # Extract the price and print it
@@ -130,5 +129,3 @@ streaming_pull_future.result()
while True: while True:
time.sleep(60) time.sleep(60)
# %%
-1
View File
@@ -108,7 +108,6 @@ if len(sys.argv) < 2:
app.run() app.run()
command = sys.argv[1] command = sys.argv[1]
if command == "create": if command == "create":