File tree 4 files changed +66
-10
lines changed
4 files changed +66
-10
lines changed Original file line number Diff line number Diff line change 12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
14
15
- runtime : python310
15
+ # runtime: python310
16
+ runtime : python27
17
+ threadsafe : yes
18
+ api_version : 1
19
+
20
+ handlers :
21
+ - url : /.*
22
+ script : main.app
23
+
24
+ libraries :
25
+ - name : setuptools
26
+ version : latest
27
+ - name : grpcio
28
+ version : latest
Original file line number Diff line number Diff line change
1
+ # Copyright 2022 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ runtime : python310
Original file line number Diff line number Diff line change
1
+ # Copyright 2021 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ import pkg_resources
16
+ from google .appengine .ext import vendor
17
+
18
+ # Set PATH to your libraries folder.
19
+ PATH = 'lib'
20
+ # Add libraries installed in the PATH folder.
21
+ vendor .add (PATH )
22
+ # Add libraries to pkg_resources working set to find the distribution.
23
+ pkg_resources .working_set .add_entry (PATH )
Original file line number Diff line number Diff line change @@ -63,15 +63,20 @@ def log_visitors():
63
63
# tally recent visitor counts from queue then delete those tasks
64
64
tallies = {}
65
65
acks = set ()
66
- with psc_client :
67
- rsp = psc_client .pull (subscription = SUB_PATH , max_messages = TASKS )
68
- msgs = rsp .received_messages
69
- for rcvd_msg in msgs :
70
- acks .add (rcvd_msg .ack_id )
71
- visitor = rcvd_msg .message .data .decode ('utf-8' )
72
- tallies [visitor ] = tallies .get (visitor , 0 ) + 1
73
- if acks :
74
- psc_client .acknowledge (subscription = SUB_PATH , ack_ids = acks )
66
+ #with psc_client:
67
+ rsp = psc_client .pull (subscription = SUB_PATH , max_messages = TASKS )
68
+ msgs = rsp .received_messages
69
+ for rcvd_msg in msgs :
70
+ acks .add (rcvd_msg .ack_id )
71
+ visitor = rcvd_msg .message .data .decode ('utf-8' )
72
+ tallies [visitor ] = tallies .get (visitor , 0 ) + 1
73
+ if acks :
74
+ psc_client .acknowledge (subscription = SUB_PATH , ack_ids = acks )
75
+ if hasattr (psc_client , 'close' ):
76
+ try :
77
+ psc_client .close ()
78
+ except AttributeError :
79
+ pass
75
80
76
81
# increment those counts in Datastore and return
77
82
if tallies :
You can’t perform that action at this time.
0 commit comments