Skip to content

Commit 0341358

Browse files
chenqichenqi
authored andcommitted
misc change
1 parent 044244c commit 0341358

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

PageSpeedInsights/job.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/local/bin/python3
2+
# -*- coding: utf-8 -*-
3+
'''PageSpeed Insights Job + Google Cloud Functions'''
4+
import os
5+
from google.cloud import pubsub_v1
6+
7+
PROJECT_ID = os.getenv("GCP_PROJECT_ID")
8+
TOPIC_NAME = os.getenv("GCP_TOPIC_NAME")
9+
10+
def run(event, context):
11+
publisher = pubsub_v1.PublisherClient()
12+
topic = publisher.topic_path(PROJECT_ID, TOPIC_NAME)
13+
data = None
14+
publisher.publish(topic, data)
15+
16+
print('Topic created: {}'.format(topic))
17+
return 'OK'
18+
19+
def test_job():
20+
print()
21+
22+
if __name__ == "__main__":
23+
test_job()

PageSpeedInsights/psi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/local/bin/python3
22
# -*- coding: utf-8 -*-
3-
'''PageSpeed Insights + Google Cloud Functions'''
3+
'''PageSpeed Insights Single + Google Cloud Functions'''
44
import os
55
from googleapiclient.discovery import build
66

0 commit comments

Comments
 (0)