import requests
import traceback


def text(url, encoding=""):
	"""
	Returns the remote file as a string
	:param url: str - url to retrieve the text content
	:param encoding: str - (optional) character encoding
	:return: str
	"""
	try:
		r = requests.get(url)
		if encoding:
			r.encoding = encoding
		return r.text
	except:
		print(traceback.print_exc())
		pass
		return ""