def response_to_dict(res):
	"""
	Pull out response data.

	Params:
	res (Response): return value of requests.request.

	Return: dict of data in res.
	"""

	headers = dict(res.headers)

	return {
		'url': res.url,
		'status_code': res.status_code,
		'headers': headers,
		'text': dict(res.json()) if 'Content-Type' in headers and 'application/json' in headers['Content-Type'].lower() else res.text
	}