Commit ff469f23 authored by Kyle Sunden's avatar Kyle Sunden
Browse files

Merge branch 'format_str' into 'master'

Use format strings instead of assuming concatenation

Closes #2

See merge request !4
parents d19aca72 1e9f17bc
......@@ -47,9 +47,9 @@ class GDrive(yaqd_core.Base):
"token_url": "",
"create_file_url": "",
"generate_ids_url": "",
"update_file_url": "", # Needs fileId
"download_url": "", # Needs fileId
"open_url": "", # Needs fileId
"update_file_url": "{fileId}", # Needs fileId
"download_url": "{fileId}", # Needs fileId
"open_url": "{fileId}", # Needs fileId
def __init__(self, name, config, config_filepath):
......@@ -175,7 +175,7 @@ class GDrive(yaqd_core.Base):
with open(file_, "rb") as f:
async with self._http_session.patch(
params={"uploadType": "multipart"},
......@@ -316,10 +316,10 @@ class GDrive(yaqd_core.Base):
return drive_id
def id_to_open_url(self, id_):
return f"{self._open_url}{self._id_mapping.get(id_, id_)}"
return self._open_url.format(fileId=self._id_mapping.get(id_, id_))
def id_to_download_url(self, id_):
return f"{self._download_url}{self._id_mapping.get(id_, id_)}"
return self._download_url.format(fileId=self._id_mapping.get(id_, id_))
def create_folder(self, path, parent_id=None, id_=None):
path = pathlib.Path(path)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment