Updated python code to work with caching and corrected date parsing