title: Is threading.local() a safe way to store variables for a single request in Google AppEngine?
body: <p>I have a google appengine app where I want to set a global variable for that request only. Can I do this?</p>
  
  <p>In request_vars.py</p>
  
  <pre><code># request_vars.py
  
  global_vars = threading.local()
  </code></pre>
  
  <p>In another.py</p>
  
  <pre><code># another.py
  
  from request_vars import global_vars
  get_time():
      return global_vars.time_start
  </code></pre>
  
  <p>In main.py</p>
  
  <pre><code># main.py
  
  import another
  from request_vars import global_vars
  
  global_vars.time_start = datetime.datetime.now()
  
  time_start = another.get_time()
  </code></pre>
  
  <p>Questions: Considering multithreading, concurrent requests, building on Google AppEngine, and hundreds (even thousands) of requests per second, will the value of <code>time_start</code> always be equal to the value set in <code>global_vars.time_start</code> in <code>main.py</code> per request? Is this safe to use with multithreading/threadsafe enabled?</p>