Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7091993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:15:26+00:00 2026-05-28T08:15:26+00:00

I serve static KML from the blobstore as a file that I saved to

  • 0

I serve static KML from the blobstore as a file that I saved to the blobstore

class KMLHandler2(blobstore_handlers.BlobstoreDownloadHandler):

    def get(self):
        resource = 'AMIfv965WtxAc_rWOVjSSx423_oe6f-g5obWYNKX5scg-1gqvISyaZCnv6lRaqro2wOVNOogttyMOylFLsRYZ3Y9UYIe-A69vAt4pdJB2-SHUcdVEM2v0XVLxzT3fTlxwXQVhzmsHPwALH_rCSFIvmYcuV37asVD0Q'
        resource = str(urllib.unquote(resource))
        blob_info = blobstore.BlobInfo.get(resource)
        self.send_blob(blob_info)

This works but I want to update the file regularly. The file is generated from /list.kml so I could read it directly from there but then it times out so my plan is to make my first appenine task that reads the file from list.kml and writes it to the blobstore with that same key but how do I do that when the only examples are how to create a new file? I have the places in the code where I update the data layer and it’ not very often. Can you suggest how I should do when I update the file? I suppose I want the key and id to be the same and replace the old blob instead of writing a new and refreshing the key. Can you help me? The app engine docs say how to write a blobstore file but only a new one, I don’t know how to edit or replace a file given it’s key and I think that is what I need to do as a task or a cron job so I ask for your help.

I could make a handler like in the docs but that is for creating a file, not modifying / replacing one:

class CreateKMLHandler(webapp2.RequestHandler):
    def get(self):
        # Create the file
        file_name = files.blobstore.create(mime_type='application/octet-stream')

        # Open the file and write to it
        with files.open(file_name, 'a') as f:
          f.write('data')

        # Finalize the file. Do this before attempting to read it.
        files.finalize(file_name)

        # Get the file's blob key
        blob_key = files.blobstore.get_blob_key(file_name)

Thanks

Update

I try this code to make a new file but it get a deadline error applicationerror 5 which I suppose is a timeout issue. How can I make it a task instead?

class CreateKMLHandler(webapp2.RequestHandler):
    def get(self):
        # Create the file
        file_name = files.blobstore.create(mime_type='application/octet-stream')

        url = 'http://montaoproject.appspot.com/list.kml'

        result = urlfetch.fetch(url)
        if not result.content:
            return

        # Open the file and write to it
        with files.open(file_name, 'a') as f:
          f.write(result.content)

        # Finalize the file. Do this before attempting to read it.
        files.finalize(file_name)

        # Get the file's blob key
        blob_key = files.blobstore.get_blob_key(file_name)
        self.out.write(blob_key)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T08:15:26+00:00Added an answer on May 28, 2026 at 8:15 am

    Once blobs have been written, they can not be changed (only read or deleted). You could use datastore entities to keep track of the current blob key associated with a given KML ‘document’.

    You might also be interested in the Cloud Storage API ( http://code.google.com/appengine/docs/python/googlestorage/overview.html ), which allows you to overwrite ‘bucket’ objects by creating new objects with the same name.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Comet Server Orbited can serve static files from paths specified in it's config file
I want to serve my css and images from a static cookieless domain. Now
I'm trying to build a blog/messageboard that uses static HTML files to serve content.
I'm currently facing the problem that I want to serve static content via a
In a system that I'm building I want to serve Static files (static HTML
I am trying to serve static files from another domain (sub domain of current
I have a node.js app that serve static files (html, js, css). Among the
I am writing a web application that uses nginx to serve static content and
How to respect Serve static content from a cookieless domain page speed rule in
I am using webpy framefork. I want to serve static file on one of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.