import pywikibot
from pywikibot.data import api
import json
from datetime import datetime

'''
# First token
token1_params = {"action":"query","format":"json","meta":"tokens"}
token1_request = api.Request(site=site, **token1_params)
token1_response = token1_request.submit()
token1 = token1_response['query']['tokens']['csrftoken']
print ("First token:", token1)
'''

site = pywikibot.Site("en", "wikipedia")

def stage1():
	print("Stage 1 is now starting")
		
	issue_date = datetime.utcnow().strftime("%Y-%m-%d")
	issue = ("Wikipedia:Wikipedia Signpost/" + issue_date)
	print ("Issue that will be published: " + issue)
		
	# Get the list of articles for this week
	'''
	list_params = {"action":"query", "format":"json", "list":"prefixsearch", "pssearch":"Wikipedia:Wikipedia Signpost/Next/"}
	list_request = api.Request(site=site, **list_params)
	list_response = list_request.submit()
	list = list_response['query']['prefixsearch']
	'''
	
	cat = catlib.Category(site, u'Category:Next_Signpost_issue')
	pages = cat.articlesList(False)
	for Page in pagegenerators.PreloadingGenerator(pages,100):
		treatment(Page.title())
	print (pages)

def main():

	start = str(raw_input("Would you like to start publication? 'y' to continue, anything else to exit. "))
	
	if start == "y":
		site.login
		stage1()
	else:
		print("Aborting.")
		return

main()
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-4ec30dc51859> in <module>()
      3 import json
      4 from datetime import datetime
----> 5 import pagegenerators
      6 
      7 '''

ImportError: No module named 'pagegenerators'