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 8684137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:13:40+00:00 2026-06-12T22:13:40+00:00

I’m using the python API for Google App Engine, and what I am trying

  • 0

I’m using the python API for Google App Engine, and what I am trying to do is load a list of files from a server if it has passed more than an interval of time (e.g 1 hour).

For this I tried to store the last operation hour of execution to a file and read it the next time to know the difference with the current time of execution of the next request, but then i found out that GAE does not allow to write files to disk, so I had to use the blobstore. I tried to put together the same functions i already had but using the blobstore functions, but even when the file is created, everytime i try to read it I get an error saying:

FinalizationError: ApplicationError: 101 Blobkey not found.

I’m not sure what I’m doing is wrong. I’m pretty new to GAE and don’t know if this is the best approach to do what I need to do, and I couldn’t find an example where you read and write files in the same script in the documentation of the GAE Files API.

Thanks in advance for any hints you can give me.

This is a summarized version of my code, the get and set functions are as they are in the code:

# imports...
from datetime import datetime as time
from google.appengine.api import files

# create file
last_request_file = files.blobstore.create()


def update_list(time_interval):
    # Get the time of the current request
    current_time = time.now()

    # Calculate timelapse between this an the last request
    last_request = get_last_request_time(last_request_file)
    elapsed_time = current_time - last_request

    # If more than an interval update proxy list
    if elapsed_time.total_seconds() >= time_interval:
        # Request new list from the server
        my_list = getList()

    # Update last_request time
    set_last_request(last_request_file)

    return my_ist


def get_last_request_time(file_name):
    request_time = None

    with files.open(file_name, 'r') as f:
        text_time = f.read()
        if text_time:
            request_time = time.strptime(text_time, '%Y-%m-%d %H:%M:%S')
        else: # file was empty
            request_time = time.min

    # Finalize to close the file.
    files.finalize(file_name)

    return request_time


def set_last_request_time(file_name):
    current_time = time.now()

    # Open the file and write to it
    with files.open(file_name, 'a') as f:
        f.write(time.strftime(current_time, '%Y-%m-%d %H:%M:%S')+'\n')

    # Finalize to close the file.
    files.finalize(file_name)
  • 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-06-12T22:13:41+00:00Added an answer on June 12, 2026 at 10:13 pm

    First: Why do’not store the information in a task queue. You can run a task queue every hour to do your job (get list).

    Second: You only use finalize if you create a file and write to it. But you cannot write to a file, after it has been finalized. To update a file in the blobstore, you always have to create a new one. And when you read a file, you do not have to finalize it. To read a file you have to use a blobreader. See: https://developers.google.com/appengine/docs/python/blobstore/blobreaderclass

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

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
That's pretty much it. I'm using Nokogiri to scrape a web page what has
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have thousands of HTML files to process using Groovy/Java and I need to
I am using Paperclip to handle profile photo uploads in my app. They upload
I have a bunch of posts stored in text files formatted in yaml/textile (from
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.