Skip to content

Commit

Permalink
v1.4.2
Browse files Browse the repository at this point in the history
- Renamed set_folder_options function to set_folder_option
- Fixed wrong api endpoint in set_folder_option function
- Updated docstrings
  • Loading branch information
Itz-fork committed Jun 28, 2022
1 parent a0173fe commit 7136d1c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ g_a.upload(file="path_to_your_file")
g_a.create_folder(parentFolderId="your_root_folder_id", folderName="Folder Name")

# Set folder options
g_a.set_folder_options(folderId="id_of_the_folder", option="your_option", value="your_value")
g_a.set_folder_option(folderId="id_of_the_folder", option="your_option", value="your_value")

# Get content details
g_a.get_content(contentId="id_of_the_file_or_folder")
Expand Down
2 changes: 1 addition & 1 deletion gofile2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
from .gofile2 import Gofile
from .async_gofile2 import Async_Gofile

__version__ = "v1.4.1"
__version__ = "v1.4.2"
10 changes: 5 additions & 5 deletions gofile2/async_gofile2.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,18 +189,18 @@ async def create_folder(self, parentFolderId, folderName):
except Exception as e:
raise JobFailed(e)

async def set_folder_options(self, folderId, option, value):
async def set_folder_option(self, folderId, option, value):
"""
### Set Folder Options Function:
### Set Folder Option Function:
Set an option on a folder
### Arguments:
- `folderId` - The ID of the folder
- `option` - Option that you want to set. Can be "private", "password", "description", "expire" or "tags"
- `option` - Option that you want to set. Can be "public", "password", "description", "expire" or "tags"
- `value` - The value of the option to be defined.
- For "private", can be "true" or "false".
- For "public", can be "true" or "false".
- For "password", must be the password.
- For "description", must be the description.
- For "expire", must be the expiration date in the form of unix timestamp.
Expand All @@ -213,7 +213,7 @@ async def set_folder_options(self, folderId, option, value):
async with ClientSession() as session:
try:
set_folder_resp = await session.put(
url=f"{self.api_url}setFolderOptions",
url=f"{self.api_url}setFolderOption",
data={
"token": self.token,
"folderId": folderId,
Expand Down
21 changes: 11 additions & 10 deletions gofile2/gofile2.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# Project: Gofile2
import os

from requests import get, post, put, delete
from .errors import (InvalidPath, InvalidToken, JobFailed, ResponseError,
is_valid_token)
from requests import delete, get, post, put
from .errors import (InvalidOption, InvalidPath, InvalidToken, JobFailed,
ResponseError, is_valid_token)


class Gofile:
Expand Down Expand Up @@ -175,30 +175,31 @@ def create_folder(self, parentFolderId, folderName):
raise JobFailed(
f"Error Happend: {e} \n\nReport this at ----> https://github.com/Itz-fork/Gofile2/issues")

def set_folder_options(self, folderId, option, value):
def set_folder_option(self, folderId, option, value):
"""
### Set Folder Options Function:
### Set Folder Option Function:
Set an option on a folder
### Arguments:
- `folderId` - The ID of the folder
- `option` - Option that you want to set. Can be "private", "password", "description", "expire" or "tags"
- `option` - Option that you want to set. Can be "public", "password", "description", "expire" or "tags"
- `value` - The value of the option to be defined.
- For "private", can be "true" or "false".
- For "public", can be "true" or "false".
- For "password", must be the password.
- For "description", must be the description.
- For "expire", must be the expiration date in the form of unix timestamp.
- For "tags", must be a comma seperated list of tags.
"""
token = self.token
if token is None:
raise InvalidToken(
"Token is required for this action but it's None")
raise InvalidToken()
if not option in ["public", "password", "description", "expire", "tags"]:
raise InvalidOption(option)
try:
set_folder_resp = put(
url=f"{self.api_url}setFolderOptions",
url=f"{self.api_url}setFolderOption",
data={
"token": token,
"folderId": folderId,
Expand Down

0 comments on commit 7136d1c

Please sign in to comment.