 <p>Add <code>global next_page</code> to the beginning of function <code>getPosts()</code> instead of pass the parameter into it, so that you update the value of global variable <code>next_page</code> . And declare the global variable next_page as a str <code>''</code> instead of list<code>[]</code>.</p>