forked from SVIG/python-bootcamp
Update 'NFL Zip Code.py'
This commit is contained in:
@@ -2,37 +2,27 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
# In[1]:
|
# In[1]:
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from google.cloud import pubsub_v1
|
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 = 'price-extraction-project'
|
project_id = 'price-extraction-project'
|
||||||
topic_name = 'nfl-zipcodes'
|
topic_name = 'nfl-zipcodes'
|
||||||
|
|
||||||
|
|
||||||
# In[3]:
|
# In[3]:
|
||||||
|
|
||||||
|
|
||||||
# Create a publisher client
|
# Create a publisher client
|
||||||
publisher = pubsub_v1.PublisherClient()
|
publisher = pubsub_v1.PublisherClient()
|
||||||
|
|
||||||
|
|
||||||
# In[4]:
|
# In[4]:
|
||||||
|
|
||||||
|
|
||||||
# Get the topic path
|
# Get the topic path
|
||||||
topic_path = publisher.topic_path(project_id, topic_name)
|
topic_path = publisher.topic_path(project_id, topic_name)
|
||||||
|
|
||||||
|
|
||||||
# In[5]:
|
# In[5]:
|
||||||
|
|
||||||
|
|
||||||
# Define the zip codes for all NFL cities
|
# Define the zip codes for all NFL cities
|
||||||
nfl_zipcodes = {
|
nfl_zipcodes = {
|
||||||
'Arizona Cardinals': '85305',
|
'Arizona Cardinals': '85305',
|
||||||
@@ -71,8 +61,6 @@ nfl_zipcodes = {
|
|||||||
|
|
||||||
|
|
||||||
# In[6]:
|
# In[6]:
|
||||||
|
|
||||||
|
|
||||||
# Publish each zip code to the topic
|
# Publish each zip code to the topic
|
||||||
for team, zipcode in nfl_zipcodes.items():
|
for team, zipcode in nfl_zipcodes.items():
|
||||||
data = f'{team} - {zipcode}'.encode('utf-8')
|
data = f'{team} - {zipcode}'.encode('utf-8')
|
||||||
@@ -82,8 +70,6 @@ print('All zip codes published.')
|
|||||||
|
|
||||||
|
|
||||||
# In[ ]:
|
# In[ ]:
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
|
|||||||
Reference in New Issue
Block a user