Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: third_party/gsutil/20110627/cloudreader/cloudreader.py

Issue 10199002: Upgrade gsutil to 3.4 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 #
3 # Copyright 2010 Google Inc.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 """Example Google App Engine application."""
18
19 import os
20
21 # Point to our boto.cfg before importing boto, because boto statically
22 # initializes credentials when its loaded.
23 os.environ['BOTO_CONFIG'] = 'boto.cfg'
24 import boto
25
26 from boto.exception import S3ResponseError
27 from boto.pyami.config import Config
28 from google.appengine.ext import webapp
29 from google.appengine.ext.webapp.util import run_wsgi_app
30
31 class MainPage(webapp.RequestHandler):
32 def get(self):
33 self.response.out.write('<html><body><pre>')
34 try:
35 uri = boto.storage_uri('gs://pub/shakespeare/rose.txt')
36 poem = uri.get_contents_as_string()
37 self.response.out.write('<pre>' + poem + '</pre>')
38 self.response.out.write('</body></html>')
39 except AttributeError, e:
40 self.response.out.write('<b>Failure: %s</b>' % e)
41 except S3ResponseError, e:
42 self.response.out.write(
43 '<b>Failure: status=%d, code=%s, reason=%s.</b>' %
44 (e.status, e.code, e.reason))
45
46 def main():
47 application = webapp.WSGIApplication([('/', MainPage)], debug=True)
48 run_wsgi_app(application)
49
50 if __name__ == "__main__":
51 main()
OLDNEW
« no previous file with comments | « third_party/gsutil/20110627/cloudreader/boto.cfg ('k') | third_party/gsutil/20110627/cloudreader/index.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698