# Path: mainhandler.py
# class Handler(webapp2.RequestHandler):
#     def write(self, *a, **kw):
#         self.response.out.write(*a, **kw)
# 
#     def render_str(self, template, **params):
#         t = jinja_env.get_template(template)
#         return t.render(params)
# 
#     def render(self, template, **kw):
#         self.write(self.render_str(template, **kw))
# 
#     def render_front(self, template):
#         self.render(template)
# 
# Path: app/content/index.py
# class MainPage(Handler):
#     def get(self):
#         self.render_front("index.html")
# 
# Path: app/content/experience.py
# class Experience(Handler):
#     def get(self):
#         self.response.headers['Content-Type'] = 'application/json'
#         self.write(json.dumps(get_gist_data('3735396','experience_data')))
# 
# Path: app/content/education.py
# class Education(Handler):
#     def get(self):
#         self.response.headers['Content-Type'] = 'application/json' 
#         self.write(json.dumps(get_gist_data('3735401','education_data')))
# 
# Path: app/content/projects.py
# class Projects(Handler):
#     def get(self):
#         self.response.headers['Content-Type'] = 'application/json'
#         self.write(json.dumps(get_gist_data('3734919','projects_data')))
# 
# Path: app/content/contact.py
# class Contact(Handler):
#     def get(self):
#         self.response.headers['Content-Type'] = 'application/json'
#         self.write(json.dumps(get_gist_data('3785786','contact_data')))
# 
# Path: app/content/achievements.py
# class Achievements(Handler):
#     def get(self):
#         self.response.headers['Content-Type'] = 'application/json'
#         self.write(json.dumps(get_gist_data('3785895','achievements_data')))
# 
# Path: app/utilities/githubactivity.py
# class GithubActivity(Handler):
#     def get(self):
#         activity = {}
#         entries = []
#         user = setUser("<username>", "<password>")
#         entries = entries + getFollowers(user)
#         entries = entries + getFollowing(user)
#         entries = entries + getWatchedRepos(user)
#         activity['activities'] = entries
#         self.response.headers['Content-Type'] = 'application/json'
#         self.write(json.dumps(activity))
# 
# Path: app/utilities/githubarchive.py
# class GithubArchiveBigQuery(Handler):
#     def get(self):
#         self.response.headers['Content-Type'] = 'application/json'
#         """Local_parser_result
#         self.write(json.dumps(local_archive))
#         """
#         """Remote_parser_result"""
#         service = build("bigquery", "v2", http=http)        
#         parsed_archive = execute_bigquery_githubarchive(service)
#         self.write(json.dumps(parsed_archive))
# 
# class GithubArchiveHTML(Handler):
#     def get(self):
#         #self.render_front("timeline.html")                
#         self.render("metro_github_archive.html")
# 
# class TopRepos(Handler):
#     def get(self):
#         self.response.headers['Content-Type'] = 'application/json'
#         service = build("bigquery", "v2", http=http)
#         parsed_archive = execute_bigquery_toprepos(service)
#         self.write(json.dumps(parsed_archive))
# 
# class TopLanguages(Handler):
#     def get(self):
#         self.response.headers['Content-Type'] = 'application/json'
#         service = build("bigquery", "v2", http=http)
#         parsed_archive = execute_bigquery_toplanguages(service)
#         self.write(json.dumps(parsed_archive))
# 
# class MostActiveUsers(Handler):
#     def get(self):
#         self.response.headers['Content-Type'] = 'application/json'
#         service = build("bigquery", "v2", http=http)
#         parsed_archive = execute_bigquery_mostactive_users(service)
#         self.write(json.dumps(parsed_archive))


import webapp2
from mainhandler import Handler
from app.content.index import MainPage
from app.content.experience import Experience
from app.content.education import Education
from app.content.projects import Projects
from app.content.contact import Contact
from app.content.achievements import Achievements
from app.utilities.githubactivity import GithubActivity
from app.utilities.githubarchive import GithubArchiveBigQuery, GithubArchiveHTML, TopRepos, TopLanguages, MostActiveUsers

app = webapp2.WSGIApplication([('/home', MainPage),                                
                               ('/projects', Projects), 
                               ('/experience', Experience),
                               ('/education', Education),
                               ('/contact', Contact),
                               ('/achievements', Achievements),
                               ('/github_activity', GithubActivity),
                               ('/github_archive', GithubArchiveHTML),

# Path: mainhandler.py
# class Handler(webapp2.RequestHandler):
#     def write(self, *a, **kw):
#         self.response.out.write(*a, **kw)
# 
#     def render_str(self, template, **params):
#         t = jinja_env.get_template(template)
#         return t.render(params)
# 
#     def render(self, template, **kw):
#         self.write(self.render_str(template, **kw))
# 
#     def render_front(self, template):
#         self.render(template)
# 
# Path: app/content/index.py
# class MainPage(Handler):
#     def get(self):
#         self.render_front("index.html")
# 
# Path: app/content/experience.py
# class Experience(Handler):
#     def get(self):
#         self.response.headers['Content-Type'] = 'application/json'
#         self.write(json.dumps(get_gist_data('3735396','experience_data')))
# 
# Path: app/content/education.py
# class Education(Handler):
#     def get(self):
#         self.response.headers['Content-Type'] = 'application/json' 
#         self.write(json.dumps(get_gist_data('3735401','education_data')))
# 
# Path: app/content/projects.py
# class Projects(Handler):
#     def get(self):
#         self.response.headers['Content-Type'] = 'application/json'
#         self.write(json.dumps(get_gist_data('3734919','projects_data')))
# 
# Path: app/content/contact.py
# class Contact(Handler):
#     def get(self):
#         self.response.headers['Content-Type'] = 'application/json'
#         self.write(json.dumps(get_gist_data('3785786','contact_data')))
# 
# Path: app/content/achievements.py
# class Achievements(Handler):
#     def get(self):
#         self.response.headers['Content-Type'] = 'application/json'
#         self.write(json.dumps(get_gist_data('3785895','achievements_data')))
# 
# Path: app/utilities/githubactivity.py
# class GithubActivity(Handler):
#     def get(self):
#         activity = {}
#         entries = []
#         user = setUser("<username>", "<password>")
#         entries = entries + getFollowers(user)
#         entries = entries + getFollowing(user)
#         entries = entries + getWatchedRepos(user)
#         activity['activities'] = entries
#         self.response.headers['Content-Type'] = 'application/json'
#         self.write(json.dumps(activity))
# 
# Path: app/utilities/githubarchive.py
# class GithubArchiveBigQuery(Handler):
#     def get(self):
#         self.response.headers['Content-Type'] = 'application/json'
#         """Local_parser_result
#         self.write(json.dumps(local_archive))
#         """
#         """Remote_parser_result"""
#         service = build("bigquery", "v2", http=http)        
#         parsed_archive = execute_bigquery_githubarchive(service)
#         self.write(json.dumps(parsed_archive))
# 
# class GithubArchiveHTML(Handler):
#     def get(self):
#         #self.render_front("timeline.html")                
#         self.render("metro_github_archive.html")
# 
# class TopRepos(Handler):
#     def get(self):
#         self.response.headers['Content-Type'] = 'application/json'
#         service = build("bigquery", "v2", http=http)
#         parsed_archive = execute_bigquery_toprepos(service)
#         self.write(json.dumps(parsed_archive))
# 
# class TopLanguages(Handler):
#     def get(self):
#         self.response.headers['Content-Type'] = 'application/json'
#         service = build("bigquery", "v2", http=http)
#         parsed_archive = execute_bigquery_toplanguages(service)
#         self.write(json.dumps(parsed_archive))
# 
# class MostActiveUsers(Handler):
#     def get(self):
#         self.response.headers['Content-Type'] = 'application/json'
#         service = build("bigquery", "v2", http=http)
#         parsed_archive = execute_bigquery_mostactive_users(service)
#         self.write(json.dumps(parsed_archive))


# Path: home.py
import webapp2
from mainhandler import Handler
from app.content.index import MainPage
from app.content.experience import Experience
from app.content.education import Education
from app.content.projects import Projects
from app.content.contact import Contact
from app.content.achievements import Achievements
from app.utilities.githubactivity import GithubActivity
from app.utilities.githubarchive import GithubArchiveBigQuery, GithubArchiveHTML, TopRepos, TopLanguages, MostActiveUsers


app = webapp2.WSGIApplication([('/home', MainPage),                                
                               ('/projects', Projects), 
                               ('/experience', Experience),
                               ('/education', Education),
                               ('/contact', Contact),
                               ('/achievements', Achievements),
                               ('/github_activity', GithubActivity),
                               ('/github_archive', GithubArchiveHTML),

                               ('/archive_data', GithubArchiveBigQuery),