This question should help you with pulling file names from a GCS Bucket.
This site may also help.
You can get date and time from datetime
and turn that into a string.
import datetime
def date_to_string():
now = datetime.datetime.now()
date_string = ""
date_string += "{:04d}".format(now.year)
date_string += "{:02d}".format(now.month)
date_string += "{:02d}".format(now.day)
date_string += "{:02d}".format(now.hour)
date_string += "{:02d}".format(now.minute)
date_string += "{:02d}".format(now.second)
return date_string
And then you can simply check if the filename is in the list of blobs:
if "Context_"+date_string+".txt.gz" in blob_list:
do_something()