Files
onepilot/tools/lib/filereader.py
Greg Hogan 20670f0740 filereader better name for cd:/ replacement
old-commit-hash: a6b46c311e41875612e6d28f6978f4e1d1e20e46
2022-01-13 18:21:19 -08:00

12 lines
347 B
Python

import os
from tools.lib.url_file import URLFile
DATA_ENDPOINT = os.getenv("DATA_ENDPOINT", "http://data-raw.internal/")
def FileReader(fn, debug=False):
if fn.startswith("cd:/"):
fn = fn.replace("cd:/", DATA_ENDPOINT)
if fn.startswith("http://") or fn.startswith("https://"):
return URLFile(fn, debug=debug)
return open(fn, "rb")