-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6d407f5
commit a17ca04
Showing
7 changed files
with
434 additions
and
485 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import yadisk | ||
|
||
|
||
class DiskService: | ||
"""Yandex Disk API wrapper. | ||
Usage: | ||
ds = DiskService() | ||
""" | ||
|
||
def __init__(self, token) -> None: | ||
self._service = yadisk.YaDisk(token=token) | ||
|
||
def obtain_folder(self, path, **kwargs): | ||
if not self._service.exists(path): | ||
self._service.mkdir(path, **kwargs) | ||
return path | ||
|
||
def upload_docx(self, local_path, remote_path, **kwargs): | ||
with open(local_path, "rb") as f: | ||
return self._service.upload(f, remote_path, **kwargs) | ||
|
||
def delete_file(self, path, **kwargs): | ||
self._service.remove(path, **kwargs) | ||
|
||
def read_share_folder_with_anyone(self, remote_path): | ||
self._service.publish(remote_path) | ||
public_key = self._service.get_meta(remote_path)["public_key"] | ||
public_resource = self._service.get_public_meta(public_key) | ||
return public_resource["public_url"] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,4 +75,3 @@ class Applicant(Person): | |
recruitment_office: str | ||
|
||
milspecialty: Milspecialty | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters