Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cf1b498

Browse filesBrowse files
author
Jon Wayne Parrott
authored
Update samples to support latest Google Cloud Python (GoogleCloudPlatform#656)
1 parent 0b6510f commit cf1b498
Copy full SHA for cf1b498

File tree

Expand file treeCollapse file tree

82 files changed

+128
-170
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

82 files changed

+128
-170
lines changed
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Flask==0.11.1
22
gunicorn==19.6.0
3-
requests[security]==2.11.1
3+
requests[security]==2.12.0

‎appengine/flexible/datastore/main.py

Copy file name to clipboardExpand all lines: appengine/flexible/datastore/main.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
import datetime
1616
import logging
17-
import os
1817
import socket
1918

2019
from flask import Flask, request
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Flask==0.11.1
2-
google-cloud-datastore==0.20.1
2+
google-cloud-datastore==0.21.0
33
gunicorn==19.6.0
44
oauth2client==4.0.0

‎appengine/flexible/endpoints/requirements.txt

Copy file name to clipboardExpand all lines: appengine/flexible/endpoints/requirements.txt
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ flask-cors==3.0.2
33
gunicorn==19.6.0
44
six==1.10.0
55
pyyaml==3.12
6-
requests==2.11.1
6+
requests==2.12.0

‎appengine/flexible/hello_world/main.py

Copy file name to clipboardExpand all lines: appengine/flexible/hello_world/main.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def server_error(e):
3535
See logs for full stacktrace.
3636
""".format(e), 500
3737

38+
3839
if __name__ == '__main__':
3940
# This is used when running locally. Gunicorn is used to run the
4041
# application on Google App Engine. See entrypoint in app.yaml.
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
gunicorn==19.6.0
22
oauth2client==4.0.0
3-
kinto==4.3.2
3+
kinto==4.3.3
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Flask==0.11.1
22
gunicorn==19.6.0
3-
requests[security]==2.11.1
3+
requests[security]==2.12.0
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Flask==0.11.1
22
gunicorn==19.6.0
3-
requests[security]==2.11.1
3+
requests[security]==2.12.0
44
mailjet-rest==v1.2.2
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Flask==0.11.1
22
gunicorn==19.6.0
3-
requests[security]==2.11.1
3+
requests[security]==2.12.0
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Flask==0.11.1
22
gunicorn==19.6.0
3-
requests==2.11.1
3+
requests==2.12.0
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Flask==0.11.1
22
gunicorn==19.6.0
3-
requests==2.11.1
3+
requests==2.12.0

‎appengine/flexible/numpy/main.py

Copy file name to clipboardExpand all lines: appengine/flexible/numpy/main.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def server_error(e):
4343
See logs for full stacktrace.
4444
""".format(e), 500
4545

46+
4647
if __name__ == '__main__':
4748
# This is used when running locally. Gunicorn is used to run the
4849
# application on Google App Engine. See entrypoint in app.yaml.
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Flask==0.11.1
2-
google-cloud-pubsub==0.20.0
2+
google-cloud-pubsub==0.21.0
33
gunicorn==19.6.0
44
oauth2client==4.0.0
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Flask==0.11.1
2-
sendgrid==3.6.2
2+
sendgrid==3.6.3
33
gunicorn==19.6.0
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Flask==0.11.1
2-
google-cloud-storage==0.20.0
2+
google-cloud-storage==0.21.0
33
gunicorn==19.6.0
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Flask==0.11.1
2-
requests==2.11.1
2+
requests==2.12.0
33
requests-toolbelt==0.7.0

‎appengine/standard/app_identity/asserting/main.py

Copy file name to clipboardExpand all lines: appengine/standard/app_identity/asserting/main.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def get(self):
5454
self.response.headers['Content-Type'] = 'application/json'
5555
self.response.write(json.dumps(result, indent=2))
5656

57+
5758
app = webapp2.WSGIApplication([
5859
('/', MainPage)
5960
], debug=True)

‎appengine/standard/app_identity/incoming/main.py

Copy file name to clipboardExpand all lines: appengine/standard/app_identity/incoming/main.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def get(self):
3838

3939
self.response.write('This is a protected page.')
4040

41+
4142
app = webapp2.WSGIApplication([
4243
('/', MainPage)
4344
], debug=True)

‎appengine/standard/appstats/main.py

Copy file name to clipboardExpand all lines: appengine/standard/appstats/main.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def get(self):
3030
value = memcache.get('example_key')
3131
self.response.write('Value is: {}'.format(value))
3232

33+
3334
app = webapp2.WSGIApplication([
3435
('/', MainPage)
3536
], debug=True)

‎appengine/standard/background/main.py

Copy file name to clipboardExpand all lines: appengine/standard/background/main.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def change_val(arg):
7777
self.response.headers['Content-Type'] = 'text/plain'
7878
self.response.write('Done')
7979

80+
8081
app = webapp2.WSGIApplication([
8182
('/', MainHandler),
8283
('/dog', SetDogHandler),

‎appengine/standard/channel/chatactoe.py

Copy file name to clipboardExpand all lines: appengine/standard/channel/chatactoe.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ def get(self):
191191
self.redirect(users.create_login_url(self.request.uri))
192192
# [END create_channel_1]
193193

194+
194195
jinja_environment = jinja2.Environment(
195196
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)))
196197

‎appengine/standard/endpoints/multiapi/main.py

Copy file name to clipboardExpand all lines: appengine/standard/endpoints/multiapi/main.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def bookmark(self, request):
4949
# [END books]
5050
# [END multiclass]
5151

52+
5253
# [START api_server]
5354
api = endpoints.api_server([api_collection])
5455
# [END api_server]
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
flask==0.11.1
2-
requests==2.11.1
2+
requests==2.12.0
33
requests_toolbelt==0.7.0
44
oauth2client==4.0.0
55
functools32==3.2.3-2; python_version < "3"

‎appengine/standard/hello_world/main.py

Copy file name to clipboardExpand all lines: appengine/standard/hello_world/main.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def get(self):
2020
self.response.headers['Content-Type'] = 'text/plain'
2121
self.response.write('Hello, World!')
2222

23+
2324
app = webapp2.WSGIApplication([
2425
('/', MainPage),
2526
], debug=True)

‎appengine/standard/localtesting/env_vars_test.py

Copy file name to clipboardExpand all lines: appengine/standard/localtesting/env_vars_test.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,6 @@ def testEnvVars(self):
3636
self.assertEqual(os.environ['MY_CONFIG_SETTING'], 'example')
3737
# [END env_example]
3838

39+
3940
if __name__ == '__main__':
4041
unittest.main()

‎appengine/standard/localtesting/login_test.py

Copy file name to clipboardExpand all lines: appengine/standard/localtesting/login_test.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,6 @@ def testLogin(self):
4949
# [END test]
5050
# [END login_example]
5151

52+
5253
if __name__ == '__main__':
5354
unittest.main()

‎appengine/standard/localtesting/mail_test.py

Copy file name to clipboardExpand all lines: appengine/standard/localtesting/mail_test.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,6 @@ def testMailSent(self):
4040
self.assertEqual('alice@example.com', messages[0].to)
4141
# [END mail_example]
4242

43+
4344
if __name__ == '__main__':
4445
unittest.main()

‎appengine/standard/localtesting/task_queue_test.py

Copy file name to clipboardExpand all lines: appengine/standard/localtesting/task_queue_test.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,6 @@ def testTaskAddedByDeferred(self):
8585
self.assertEqual(result, 3)
8686
# [END deferred]
8787

88+
8889
if __name__ == '__main__':
8990
unittest.main()

‎appengine/standard/mail/handle_bounced_email.py

Copy file name to clipboardExpand all lines: appengine/standard/mail/handle_bounced_email.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ def receive(self, bounce_message):
2626
logging.info('Bounce notification: %s', bounce_message.notification)
2727
# [END bounce_handler]
2828

29+
2930
app = webapp2.WSGIApplication([LogBounceHandler.mapping()], debug=True)

‎appengine/standard/mail/handle_incoming_email.py

Copy file name to clipboardExpand all lines: appengine/standard/mail/handle_incoming_email.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def receive(self, mail_message):
3636
plaintext = body.decode()
3737
logging.info("Plain text body of length %d.", len(plaintext))
3838

39+
3940
# [START app]
4041
app = webapp2.WSGIApplication([LogSenderHandler.mapping()], debug=True)
4142
# [END app]
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Flask==0.11.1
2-
requests==2.11.1
2+
requests==2.12.0
33
requests-toolbelt==0.7.0
44
mailjet-rest==v1.2.2

‎appengine/standard/memcache/best_practices/batch/batch.py

Copy file name to clipboardExpand all lines: appengine/standard/memcache/best_practices/batch/batch.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def get(self):
3030
self.response.write(tvalues)
3131
# [END batch]
3232

33+
3334
app = webapp2.WSGIApplication([
3435
('/', MainPage),
3536
], debug=True)

‎appengine/standard/modules/main.py

Copy file name to clipboardExpand all lines: appengine/standard/modules/main.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def get(self):
4646
pass
4747
# [END access_another_module]
4848

49+
4950
app = webapp2.WSGIApplication([
5051
('/', GetModuleInfoHandler),
5152
('/access_backend', GetBackendHandler),

‎appengine/standard/ndb/async/app_async.py

Copy file name to clipboardExpand all lines: appengine/standard/ndb/async/app_async.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ def get(self):
3232
self.response.out.write('Content of the page')
3333
future.get_result()
3434

35+
3536
app = webapp2.WSGIApplication([('/', MyRequestHandler)])

‎appengine/standard/ndb/async/app_sync.py

Copy file name to clipboardExpand all lines: appengine/standard/ndb/async/app_sync.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@ def get(self):
3131

3232
self.response.out.write('Content of the page')
3333

34+
3435
app = webapp2.WSGIApplication([('/', MyRequestHandler)])
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sendgrid==3.6.2
1+
sendgrid==3.6.3
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Flask==0.11.1
2-
requests==2.11.1
2+
requests==2.12.0
33
requests-toolbelt==0.7.0

‎appengine/standard/xmpp/xmpp.py

Copy file name to clipboardExpand all lines: appengine/standard/xmpp/xmpp.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ def post(self):
9393
message.reply("Greetings!")
9494
# [END chat]
9595

96+
9697
app = webapp2.WSGIApplication([
9798
('/_ah/xmpp/message/chat/', XMPPHandler),
9899
('/_ah/xmpp/subscribe', SubscribeHandler),

‎bigquery/api/list_datasets_projects.py

Copy file name to clipboardExpand all lines: bigquery/api/list_datasets_projects.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def main(project_id):
6767
list_datasets(bigquery, project_id)
6868
list_projects(bigquery)
6969

70+
7071
if __name__ == '__main__':
7172
parser = argparse.ArgumentParser(
7273
description=__doc__,

‎bigquery/api/load_data_by_post.py

Copy file name to clipboardExpand all lines: bigquery/api/load_data_by_post.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ def main(project_id, dataset_id, table_name, schema_path, data_path):
110110
table_name)
111111
# [END main]
112112

113+
113114
if __name__ == '__main__':
114115
parser = argparse.ArgumentParser(
115116
description=__doc__,
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
google-cloud-bigquery==0.20.0
1+
google-cloud-bigquery==0.21.0

‎bigquery/cloud-client/snippets.py

Copy file name to clipboardExpand all lines: bigquery/cloud-client/snippets.py
+7-48Lines changed: 7 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,7 @@
3535
def list_projects():
3636
bigquery_client = bigquery.Client()
3737

38-
projects = []
39-
page_token = None
40-
41-
while True:
42-
results, page_token = bigquery_client.list_projects(
43-
page_token=page_token)
44-
projects.extend(results)
45-
46-
if not page_token:
47-
break
48-
49-
for project in projects:
38+
for project in bigquery_client.list_projects():
5039
print(project.project_id)
5140

5241

@@ -57,18 +46,7 @@ def list_datasets(project=None):
5746
"""
5847
bigquery_client = bigquery.Client(project=project)
5948

60-
datasets = []
61-
page_token = None
62-
63-
while True:
64-
results, page_token = bigquery_client.list_datasets(
65-
page_token=page_token)
66-
datasets.extend(results)
67-
68-
if not page_token:
69-
break
70-
71-
for dataset in datasets:
49+
for dataset in bigquery_client.list_datasets():
7250
print(dataset.name)
7351

7452

@@ -98,17 +76,7 @@ def list_tables(dataset_name, project=None):
9876
print('Dataset {} does not exist.'.format(dataset_name))
9977
return
10078

101-
tables = []
102-
page_token = None
103-
104-
while True:
105-
results, page_token = dataset.list_tables(page_token=page_token)
106-
tables.extend(results)
107-
108-
if not page_token:
109-
break
110-
111-
for table in tables:
79+
for table in dataset.list_tables():
11280
print(table.name)
11381

11482

@@ -157,19 +125,10 @@ def list_rows(dataset_name, table_name, project=None):
157125
# Reload the table so that the schema is available.
158126
table.reload()
159127

160-
rows = []
161-
page_token = None
162-
163-
# Load at most 25 results. You can change this to `while True` and change
164-
# the max_results argument to load more rows from BigQuery, but note
165-
# that this can take some time. It's preferred to use a query.
166-
while len(rows) < 25:
167-
results, total_rows, page_token = table.fetch_data(
168-
max_results=25, page_token=page_token)
169-
rows.extend(results)
170-
171-
if not page_token:
172-
break
128+
# Load at most 25 results. You can change the max_results argument to load
129+
# more rows from BigQuery, but note that this can take some time. It's
130+
# preferred to use a query.
131+
rows = list(table.fetch_data(max_results=25))
173132

174133
# Use format to create a simple table.
175134
format_string = '{!s:<16} ' * len(table.schema)

‎bigquery/dml/requirements.txt

Copy file name to clipboard
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
flake8==3.0.4
2-
google-cloud-bigquery==0.20.0
1+
flake8==3.2.0
2+
google-cloud-bigquery==0.21.0
33
PyMySQL==0.7.9
44
six==1.10.0
55
SQLAlchemy==1.1.3

‎bigtable/hello/requirements.txt

Copy file name to clipboard
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
google-cloud-bigtable==0.20.0
1+
google-cloud-bigtable==0.21.0
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
google-cloud-datastore==0.20.1
1+
google-cloud-datastore==0.21.0

‎compute/auth/requirements.txt

Copy file name to clipboard
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
requests==2.11.1
1+
requests==2.12.0
22
google-api-python-client==1.5.5

‎compute/encryption/requirements.txt

Copy file name to clipboard
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
cryptography==1.5.3
2-
requests==2.11.1
2+
requests==2.12.0

‎compute/metadata/requirements.txt

Copy file name to clipboard
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
requests==2.11.1
1+
requests==2.12.0

‎compute/xmpp_wikibot/requirements.txt

Copy file name to clipboard
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Flask==0.11.1
2-
requests==2.11.1
2+
requests==2.12.0
33
sleekxmpp==1.3.1
44
six==1.10.0

‎dataproc/list_clusters.py

Copy file name to clipboardExpand all lines: dataproc/list_clusters.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def main(project_id, zone):
4747
result = list_clusters(dataproc, project_id)
4848
print(result)
4949

50+
5051
if __name__ == '__main__':
5152
parser = argparse.ArgumentParser(
5253
description=__doc__,

‎dataproc/requirements.txt

Copy file name to clipboard
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
google-api-python-client==1.5.5
2-
google-cloud==0.20.0
2+
google-cloud==0.21.0
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
google-cloud-datastore==0.20.1
1+
google-cloud-datastore==0.21.0

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.