forked from SVIG/python-bootcamp
Added better xpath selectors for the UI elements
This commit is contained in:
@@ -3,8 +3,9 @@ import csv
|
||||
import os
|
||||
import asyncio
|
||||
|
||||
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "C:/Users/Karen/AppData/Roaming/gcloud/application_default_credentials.json"
|
||||
project_id = "fp-20230425"
|
||||
# os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "C:/Users/Karen/AppData/Roaming/gcloud/application_default_credentials.json"
|
||||
# project_id = "fp-20230425"
|
||||
project_id = "svig-384801"
|
||||
|
||||
'''
|
||||
topic_name = "fp-topic-NFL-zipcodes"
|
||||
@@ -28,19 +29,19 @@ publisher = pubsub_v1.PublisherClient()
|
||||
topic_name = "fp-topic-NFL-zipcodes"
|
||||
topic_path = publisher.topic_path(project_id, topic_name)
|
||||
|
||||
|
||||
|
||||
# Create a Pub/Sub subscription
|
||||
subscriber = pubsub_v1.SubscriberClient()
|
||||
'''
|
||||
subscription_name = "fp-subscription-zipcodes"
|
||||
subscription_path = subscriber.subscription_path(project_id, subscription_name)
|
||||
subscription = subscriber.create_subscription(
|
||||
name=subscription_path, topic=topic_path
|
||||
)
|
||||
|
||||
'''
|
||||
# Publish a message to the topic
|
||||
# Read the data from the csv file
|
||||
file_path = "C:/Users/Karen/Desktop/zipcodes.csv"
|
||||
# file_path = "C:/Users/Karen/Desktop/zipcodes.csv"
|
||||
file_path = "zipcodes.csv"
|
||||
|
||||
with open(file_path, "r") as csv_file:
|
||||
reader = csv.reader(csv_file)
|
||||
@@ -51,11 +52,12 @@ with open(file_path, "r") as csv_file:
|
||||
future = publisher.publish(topic_path, data)
|
||||
print(f"Published message ID {future.result()}")
|
||||
|
||||
|
||||
'''
|
||||
async def receive_messages():
|
||||
response = subscriber.pull(subscription=subscription_path, max_messages=1)
|
||||
for received_message in response.received_messages:
|
||||
print("Received message: {}".format(received_message.message.data))
|
||||
|
||||
|
||||
asyncio.run(receive_messages())
|
||||
asyncio.run(receive_messages())
|
||||
'''
|
||||
|
||||
Reference in New Issue
Block a user