|
|
|
@ -80,11 +80,13 @@ class Updater(object):
@@ -80,11 +80,13 @@ class Updater(object):
|
|
|
|
|
|
|
|
|
|
dst = f"{config.raw}/{path.replace('/', '_')}.json" |
|
|
|
|
|
|
|
|
|
# mtime to datetime from timestamp, default tz, replace to GMT, format |
|
|
|
|
modified = datetime.datetime.fromtimestamp(os.path.getmtime(dst)).astimezone().replace(tzinfo=pytz.timezone('GMT')).strftime(self.RFC2616) |
|
|
|
|
self.last_modified[path] = modified |
|
|
|
|
|
|
|
|
|
return self.last_modified[path] |
|
|
|
|
try: |
|
|
|
|
# mtime to datetime from timestamp, default tz, replace to GMT, format |
|
|
|
|
modified = datetime.datetime.fromtimestamp(os.path.getmtime(dst)).astimezone().replace(tzinfo=pytz.timezone('GMT')).strftime(self.RFC2616) |
|
|
|
|
self.last_modified[path] = modified |
|
|
|
|
return self.last_modified[path] |
|
|
|
|
except FileNotFoundError: |
|
|
|
|
return None |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def set_last_modified(self, path: str, modified: str): |
|
|
|
@ -115,9 +117,6 @@ class Updater(object):
@@ -115,9 +117,6 @@ class Updater(object):
|
|
|
|
|
|
|
|
|
|
response = self.api_call(api['path'], api['namespace'], access_token, headers=headers) |
|
|
|
|
|
|
|
|
|
log(response.status_code, api) |
|
|
|
|
log(response.request.headers) |
|
|
|
|
log(response.headers) |
|
|
|
|
if response.status_code == 200: |
|
|
|
|
self.save_raw(api['path'], response) |
|
|
|
|
self.set_last_modified(api['path'], response.headers['Last-Modified']) |
|
|
|
@ -163,4 +162,4 @@ if __name__ == "__main__":
@@ -163,4 +162,4 @@ if __name__ == "__main__":
|
|
|
|
|
|
|
|
|
|
updater = Updater(region) |
|
|
|
|
updater.iterate_index() |
|
|
|
|
updater.iterate_links() |
|
|
|
|
#updater.iterate_links() |
|
|
|
|