from __future__ import print_function
from collections import OrderedDict
import json
import urllib
import requests
from woeid import (Relationships, Filters, WoeidError)
import xml.dom.minidom

__author__ = 'Renchen'
try:
	import urlparse
	from urllib import urlencode
except ImportError:
	import urllib.parse
	urlparse = urllib.parse
	from urllib.parse import urlencode


class ResponseCheck:
	"""A utility class reponsible for chekcing the reponse code and raise corresponding error

	Args:
		code(``int``):
			The response code in integer
	"""
	def __init__(self,
				 code):
		if code == 400:
			raise WoeidError("The appid parameter was invalid or not specified. or the q filter was missing or incorrectly specified for this resource.")

		if code == 404:
			raise WoeidError("The URI has no match in the display map")

		if code ==406:
			raise WoeidError("The requested representation is not available for this resource")

class Utility:
	__cached_url = None
	__response_code = None
	@staticmethod
	def BuildUrls(url,
			  path_elements,