Cobertos/md2notion

Is it possible to give URL instead of a String or MD file?

SohrabAmin opened this issue · 1 comments

When using upload() do we have the ability to give a URL as mdFile so it works almost like a web clipper?

Not directly, but it takes a file-like object, so you can do something like

import requests
r = requests.get(path)
if not r.status_code < 300: #TODO: Make this better..., should only accept success
  raise RuntimeError(f'Could not get file {path}, HTTP {r.status_code}')
fileName = path.split('?')[0]
fileName = fileName.split('/')[-1]
fileLike = io.StringIO(r.text)
fileLike.name = path

which is what the CLI does when you pass it a URL string