File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 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 ()
Original file line number Diff line number Diff line change 11#!/usr/local/bin/python3
22# -*- coding: utf-8 -*-
3- '''PageSpeed Insights + Google Cloud Functions'''
3+ '''PageSpeed Insights Single + Google Cloud Functions'''
44import os
55from googleapiclient .discovery import build
66
You can’t perform that action at this time.
0 commit comments