# Path: constants/exceptions.py
# class invalidArgumentsException(Exception):
# class loginFailedException(Exception):
# class userBannedException(Exception):
# class userLockedException(Exception):
# class noBanchoSessionException(Exception):
# class osuApiFailException(Exception):
# class fileNotFoundException(Exception):
# class invalidBeatmapException(Exception):
# class unsupportedGameModeException(Exception):
# class beatmapTooLongException(Exception):
# class need2FAException(Exception):
# class noAPIDataError(Exception):
# class scoreNotFoundError(Exception):
# class ppCalcException(Exception):
# 	def __init__(self, handler):
# 	def __init__(self, handler, who):
# 	def __init__(self, handler, who):
# 	def __init__(self, handler, who):
# 	def __init__(self, handler, who, ip):
# 	def __init__(self, handler):
# 	def __init__(self, handler, f):
# 	def __init__(self, handler):
# 	def __init__(self, handler, who, ip):
# 	def __init__(self, exception):
# 
# Path: helpers/osuapiHelper.py
# def osuApiRequest(request, params, getFirst=True):
# def getOsuFileFromName(fileName):
# def getOsuFileFromID(beatmapID):
# 		URL = "{}/web/maps/{}".format(glob.conf["OSU_API_URL"], quote(fileName))
# 		URL = "{}/osu/{}".format(glob.conf["OSU_API_URL"], beatmapID)


import json
import tornado.gen
import tornado.web
from objects import beatmap
from common.log import logUtils as log
from common.web import requestsManager
from constants import exceptions
from helpers import osuapiHelper
from common.sentry import sentry




class handler(requestsManager.asyncRequestHandler):
	"""
	Handler for /api/v1/cacheBeatmap
	"""
	MODULE_NAME = "api/cacheBeatmap"

	@tornado.web.asynchronous
	@tornado.gen.engine
	@sentry.captureTornado
	def asyncPost(self):
		statusCode = 400
		data = {"message": "unknown error"}
		try:
			# Check arguments
			if not requestsManager.checkArguments(self.request.arguments, ["sid", "refresh"]):

# Path: constants/exceptions.py
# class invalidArgumentsException(Exception):
# class loginFailedException(Exception):
# class userBannedException(Exception):
# class userLockedException(Exception):
# class noBanchoSessionException(Exception):
# class osuApiFailException(Exception):
# class fileNotFoundException(Exception):
# class invalidBeatmapException(Exception):
# class unsupportedGameModeException(Exception):
# class beatmapTooLongException(Exception):
# class need2FAException(Exception):
# class noAPIDataError(Exception):
# class scoreNotFoundError(Exception):
# class ppCalcException(Exception):
# 	def __init__(self, handler):
# 	def __init__(self, handler, who):
# 	def __init__(self, handler, who):
# 	def __init__(self, handler, who):
# 	def __init__(self, handler, who, ip):
# 	def __init__(self, handler):
# 	def __init__(self, handler, f):
# 	def __init__(self, handler):
# 	def __init__(self, handler, who, ip):
# 	def __init__(self, exception):
# 
# Path: helpers/osuapiHelper.py
# def osuApiRequest(request, params, getFirst=True):
# def getOsuFileFromName(fileName):
# def getOsuFileFromID(beatmapID):
# 		URL = "{}/web/maps/{}".format(glob.conf["OSU_API_URL"], quote(fileName))
# 		URL = "{}/osu/{}".format(glob.conf["OSU_API_URL"], beatmapID)


# Path: handlers/apiCacheBeatmapHandler.py
import json
import tornado.gen
import tornado.web
from objects import beatmap
from common.log import logUtils as log
from common.web import requestsManager
from constants import exceptions
from helpers import osuapiHelper
from common.sentry import sentry





class handler(requestsManager.asyncRequestHandler):
	"""
	Handler for /api/v1/cacheBeatmap
	"""
	MODULE_NAME = "api/cacheBeatmap"

	@tornado.web.asynchronous
	@tornado.gen.engine
	@sentry.captureTornado
	def asyncPost(self):
		statusCode = 400
		data = {"message": "unknown error"}
		try:
			# Check arguments
			if not requestsManager.checkArguments(self.request.arguments, ["sid", "refresh"]):

				raise exceptions.invalidArgumentsException(self.MODULE_NAME)