title: Best way to design a Python script that fetch data and serve a Flask REST API
body: <p>I'm having a problem understanding which could be a way to design a Python worker+API that process data gathered from the Internet and let other services(external) access this data thru an API.
  I've to tell you that I don't have a specific background in Computer Science just a lot of trial and errors that led me to get to this.</p>
  <h1>The Question</h1>
  <p><strong>How can avoid to find my API busy because the worker is fetching the data?</strong>
  Threading and queues seem to be the solution, but I'm having problems adapting my project to them. <strong>Could someone suggest me which approach should be used in this case? and projects that maybe are similar to this one?</strong></p>
  <p>I've already written a question on this on Stack without any answer, here you can find the code <a href="https://stackoverflow.com/questions/48154467/python-flask-api-service-loop-trough-api-data-sources-cache-and-give-rapid"> (my first question + code). </a></p>
  <p>This problem can be also framed in a different scale (bigger) into this question <a href="https://stackoverflow.com/questions/48307120/create-and-secure-aws-eb-application-with-multiple-environments"> ( multiple workers+Flask APIs )</a></p>
  <h1>This is my situation More or Less  <a href="https://i.stack.imgur.com/gpgA6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gpgA6.png" alt=" script structure " /></a></h1>
  <h1> References</h1>
  <p>I've also checked them out:</p>
  <ul>
  <li><a href="https://stackoverflow.com/questions/17774768/python-creating-a-shared-variable-between-threads"> Link 1 </a></li>
  <li><a href="https://stackoverflow.com/questions/2227169/are-python-built-in-containers-thread-safe"> Link 2 </a></li>
  <li><a href="https://stackoverflow.com/questions/19790570/python-global-variable-with-thread"> Link 3 </a></li>
  </ul>