gofile2


Namegofile2 JSON
Version 1.5.2 PyPI version JSON
download
home_pagehttps://github.com/Itz-fork/Gofile2
SummaryAn API wrapper for Gofile API
upload_time2024-01-05 10:51:06
maintainer
docs_urlNone
authorItz-fork, Codec04
requires_python
licenseMIT
keywords gofile api-wrapper gofile2
VCS
bugtrack_url
requirements aiohttp aiofiles
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Gofile2
```python
from gofile2 import Gofile

g_a = await Gofile.initialize()
await g_a.upload("/home/itz-fork/photo.png")
await g_a.done()
```
***An API Wrapper for Gofile API.***



# About API
> Gofile is in BETA version and this API will evolve over time. Check regularly if changes have been made.
>
Current version is compatible with `2023-04-20`

# Installation
Install via pypi
[![Downloads](https://static.pepy.tech/badge/gofile2)](https://pypi.org/project/gofile2/)
```python
pip3 install gofile2
```

To install development version [Gofile2](https://github.com/Itz-fork/Gofile2), run the following command
```python
pip install git+https://github.com/Itz-fork/Gofile2.git
```

# Usage
**1. Import [Gofile2](https://github.com/Itz-fork/Gofile2) in your python file**

**Asynchronous version**
```python
from gofile2 import Gofile
```
**Synchronous version**
```python
from gofile2 import Sync_Gofile
```

**2. Create an instance of Gofile2**

**Asynchronous version**
```python
g_a = await Gofile.initialize()
```
**Synchronous version**
```python
g_a = Sync_Gofile()
```
Above code will login as guest account. Keep in mind that only `get_server`, `upload` and `upload_folder` functions works in this mode. If you want to use other functions you will need to have a premium account (as of `2023-04-20`) token. If you need to login to your own account then pass your api token as `token` argument like below code.

```python
g_a = await Gofile.initialize(token="your_gofile_api_token_here")
```

**3. Everything Done! Now Play with it!**
```python
# Get current server
await g_a.get_server()

# Upload a folder
await g_a.upload_folder(path="path_to_your_folder")

# Upload a file
await g_a.upload(file="path_to_your_file")

# Get account info
await g_a.get_account()

# Get content details
await g_a.get_content(contentId="id_of_the_file_or_folder")

# Create folder
await g_a.create_folder(parentFolderId="your_root_folder_id", folderName="Folder Name")

# Set options
await g_a.set_option(contentId="id_of_the_contentr", option="your_option", value="your_value")

# Copy file or folder to another folder
await g_a.copy_content(contentsId="id_of_the_file_or_folder", folderIdDest="id_of_the_destination_folder")

# Delete file or folder
await g_a.delete_content(contentsId="id_of_the_file_or_folder")

# After everything, send close Gofile client
await g_a.done()
```

# Docs
- `initialize (token: Optional[str] = None) -> Gofile`
    - Create a Gofile2 object
    - `token: Optional[str]` - The access token of an account. Can be retrieved from the profile page

- `_api_request (method: str, endpoint: str, params: Optional[Dict[str, Any]] = None, data: Optional[FormData] = None, need_token: bool = True) -> Dict[str, Any]`
    - Make an API request to Gofile server
    - `method: str` - The HTTP method to use for the request
    - `endpoint: str` - The API endpoint to request
    - `params: Optional[Dict[str, Any]]` - The query parameters to include in the request
    - `data: Optional[FormData]` - The form data to include in the request
    - `need_token: bool` - Whether a token is required for the request

- `validate_token (token: str) -> None`
    - Validate gofile token
    - `token: str` - The token to validate

- `get_server () -> str`
    - Get the best server available to receive files

- `get_account () -> Dict[str, Any]`
    - Get information about the account

- `get_content (contentId: str) -> Dict[str, Any]`
    - Get information about the content
    - `contentId: str` - The ID of the file or folder

- `upload (file: str, folderId: str) -> Dict[str, Any]`
    - Upload a file to Gofile server
    - `file: str` - Path to file that want to be uploaded
    - `folderId: str` - The ID of a folder. If you're using the folderId, make sure that you initialize the Gofile class with a token

- `upload_folder (path: str, folderId: Optional[str] = None, delay: int = 3) -> List[Dict[str, Any]]`
    - Upload a folder to Gofile server
    - `path: str` - Path to folder that you want to be uploaded
    - `folderId: Optional[str]` - The ID of a folder. If you're using the folderId, make sure that you initialize the Gofile class with a token
    - `delay: int` - Time interval between file uploads (in seconds)

- `create_folder (parentFolderId: str, folderName: str) -> None`
    - Create a new folder
    - `parentFolderId: str` - The parent folder ID
    - `folderName: str` - The name of the folder that wanted to create

- `set_option (contentId: str, option: str, value: str) -> None`
    - Set an option on a content
    - `contentId: str` - The content ID
    - `option: str` - Option that you want to set. Can be "public", "password", "description", "expire" or "tags"
    - `value: str` - The value of the option to be defined.

- `copy_content (contentsId: str, folderIdDest: str) -> None`
    - Copy one or multiple contents to another folder
    - `contentsId: str` - The ID(s) of the file or folder (Separate each one by comma if there are multiple IDs)
    - `folderIdDest: str` - Destination folder ID

- `delete_content (contentsId: str) -> None`
    - Delete one or multiple files/folders
    - `contentsId: str` - The ID(s) of the file or folder (Separate each one by comma if there are multiple IDs)

- `done () -> None`
    - Close the session

_Automatically generated on 2024:01:05:13:41:40_


## Thanks to
- [gofile](https://github.com/Codec04/gofile) - Base Project & Inspiration ❤️ ([Gofile2](https://github.com/Itz-fork/Gofile2) is a Re-built version of this)
- [Itz-fork](https://github.com/Itz-fork/) (me) - For Fixing & Improving this project

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Itz-fork/Gofile2",
    "name": "gofile2",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "Gofile,Api-wrapper,Gofile2",
    "author": "Itz-fork, Codec04",
    "author_email": "itz-fork@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/c8/a8/126693398b7253cfc022e623df1316345b31de00e24c7b260b30ea167ba9/gofile2-1.5.2.tar.gz",
    "platform": null,
    "description": "# Gofile2\n```python\nfrom gofile2 import Gofile\n\ng_a = await Gofile.initialize()\nawait g_a.upload(\"/home/itz-fork/photo.png\")\nawait g_a.done()\n```\n***An API Wrapper for Gofile API.***\n\n\n\n# About API\n> Gofile is in BETA version and this API will evolve over time. Check regularly if changes have been made.\n>\nCurrent version is compatible with `2023-04-20`\n\n# Installation\nInstall via pypi\n[![Downloads](https://static.pepy.tech/badge/gofile2)](https://pypi.org/project/gofile2/)\n```python\npip3 install gofile2\n```\n\nTo install development version [Gofile2](https://github.com/Itz-fork/Gofile2), run the following command\n```python\npip install git+https://github.com/Itz-fork/Gofile2.git\n```\n\n# Usage\n**1. Import [Gofile2](https://github.com/Itz-fork/Gofile2) in your python file**\n\n**Asynchronous version**\n```python\nfrom gofile2 import Gofile\n```\n**Synchronous version**\n```python\nfrom gofile2 import Sync_Gofile\n```\n\n**2. Create an instance of Gofile2**\n\n**Asynchronous version**\n```python\ng_a = await Gofile.initialize()\n```\n**Synchronous version**\n```python\ng_a = Sync_Gofile()\n```\nAbove code will login as guest account. Keep in mind that only `get_server`, `upload` and `upload_folder` functions works in this mode. If you want to use other functions you will need to have a premium account (as of `2023-04-20`) token. If you need to login to your own account then pass your api token as `token` argument like below code.\n\n```python\ng_a = await Gofile.initialize(token=\"your_gofile_api_token_here\")\n```\n\n**3. Everything Done! Now Play with it!**\n```python\n# Get current server\nawait g_a.get_server()\n\n# Upload a folder\nawait g_a.upload_folder(path=\"path_to_your_folder\")\n\n# Upload a file\nawait g_a.upload(file=\"path_to_your_file\")\n\n# Get account info\nawait g_a.get_account()\n\n# Get content details\nawait g_a.get_content(contentId=\"id_of_the_file_or_folder\")\n\n# Create folder\nawait g_a.create_folder(parentFolderId=\"your_root_folder_id\", folderName=\"Folder Name\")\n\n# Set options\nawait g_a.set_option(contentId=\"id_of_the_contentr\", option=\"your_option\", value=\"your_value\")\n\n# Copy file or folder to another folder\nawait g_a.copy_content(contentsId=\"id_of_the_file_or_folder\", folderIdDest=\"id_of_the_destination_folder\")\n\n# Delete file or folder\nawait g_a.delete_content(contentsId=\"id_of_the_file_or_folder\")\n\n# After everything, send close Gofile client\nawait g_a.done()\n```\n\n# Docs\n- `initialize (token: Optional[str] = None) -> Gofile`\n    - Create a Gofile2 object\n    - `token: Optional[str]` - The access token of an account. Can be retrieved from the profile page\n\n- `_api_request (method: str, endpoint: str, params: Optional[Dict[str, Any]] = None, data: Optional[FormData] = None, need_token: bool = True) -> Dict[str, Any]`\n    - Make an API request to Gofile server\n    - `method: str` - The HTTP method to use for the request\n    - `endpoint: str` - The API endpoint to request\n    - `params: Optional[Dict[str, Any]]` - The query parameters to include in the request\n    - `data: Optional[FormData]` - The form data to include in the request\n    - `need_token: bool` - Whether a token is required for the request\n\n- `validate_token (token: str) -> None`\n    - Validate gofile token\n    - `token: str` - The token to validate\n\n- `get_server () -> str`\n    - Get the best server available to receive files\n\n- `get_account () -> Dict[str, Any]`\n    - Get information about the account\n\n- `get_content (contentId: str) -> Dict[str, Any]`\n    - Get information about the content\n    - `contentId: str` - The ID of the file or folder\n\n- `upload (file: str, folderId: str) -> Dict[str, Any]`\n    - Upload a file to Gofile server\n    - `file: str` - Path to file that want to be uploaded\n    - `folderId: str` - The ID of a folder. If you're using the folderId, make sure that you initialize the Gofile class with a token\n\n- `upload_folder (path: str, folderId: Optional[str] = None, delay: int = 3) -> List[Dict[str, Any]]`\n    - Upload a folder to Gofile server\n    - `path: str` - Path to folder that you want to be uploaded\n    - `folderId: Optional[str]` - The ID of a folder. If you're using the folderId, make sure that you initialize the Gofile class with a token\n    - `delay: int` - Time interval between file uploads (in seconds)\n\n- `create_folder (parentFolderId: str, folderName: str) -> None`\n    - Create a new folder\n    - `parentFolderId: str` - The parent folder ID\n    - `folderName: str` - The name of the folder that wanted to create\n\n- `set_option (contentId: str, option: str, value: str) -> None`\n    - Set an option on a content\n    - `contentId: str` - The content ID\n    - `option: str` - Option that you want to set. Can be \"public\", \"password\", \"description\", \"expire\" or \"tags\"\n    - `value: str` - The value of the option to be defined.\n\n- `copy_content (contentsId: str, folderIdDest: str) -> None`\n    - Copy one or multiple contents to another folder\n    - `contentsId: str` - The ID(s) of the file or folder (Separate each one by comma if there are multiple IDs)\n    - `folderIdDest: str` - Destination folder ID\n\n- `delete_content (contentsId: str) -> None`\n    - Delete one or multiple files/folders\n    - `contentsId: str` - The ID(s) of the file or folder (Separate each one by comma if there are multiple IDs)\n\n- `done () -> None`\n    - Close the session\n\n_Automatically generated on 2024:01:05:13:41:40_\n\n\n## Thanks to\n- [gofile](https://github.com/Codec04/gofile) - Base Project & Inspiration \u2764\ufe0f ([Gofile2](https://github.com/Itz-fork/Gofile2) is a Re-built version of this)\n- [Itz-fork](https://github.com/Itz-fork/) (me) - For Fixing & Improving this project\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "An API wrapper for Gofile API",
    "version": "1.5.2",
    "project_urls": {
        "Download": "https://github.com/Itz-fork/Gofile2/releases/tag/Gofile2-v1.5.2",
        "Homepage": "https://github.com/Itz-fork/Gofile2"
    },
    "split_keywords": [
        "gofile",
        "api-wrapper",
        "gofile2"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "14fb5b9230ff5b6846a289467b16235266eb0524ea3e3b9446346a57882753f3",
                "md5": "e674765f48ff78e4180773fabbe2ca20",
                "sha256": "37262120458c3fbbb14e98398e6f4d3cbdc5dcfc0e9af887eb9c83b924cac2e3"
            },
            "downloads": -1,
            "filename": "gofile2-1.5.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e674765f48ff78e4180773fabbe2ca20",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 9078,
            "upload_time": "2024-01-05T10:51:04",
            "upload_time_iso_8601": "2024-01-05T10:51:04.537959Z",
            "url": "https://files.pythonhosted.org/packages/14/fb/5b9230ff5b6846a289467b16235266eb0524ea3e3b9446346a57882753f3/gofile2-1.5.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c8a8126693398b7253cfc022e623df1316345b31de00e24c7b260b30ea167ba9",
                "md5": "b2963c32eb7068c4847519577d39ee36",
                "sha256": "2663b70c489ae21aa00c0313da9e8fa3dd9400cfb8e432f052e9ab3af8370aa8"
            },
            "downloads": -1,
            "filename": "gofile2-1.5.2.tar.gz",
            "has_sig": false,
            "md5_digest": "b2963c32eb7068c4847519577d39ee36",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 8937,
            "upload_time": "2024-01-05T10:51:06",
            "upload_time_iso_8601": "2024-01-05T10:51:06.390140Z",
            "url": "https://files.pythonhosted.org/packages/c8/a8/126693398b7253cfc022e623df1316345b31de00e24c7b260b30ea167ba9/gofile2-1.5.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-05 10:51:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Itz-fork",
    "github_project": "Gofile2",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "aiohttp",
            "specs": [
                [
                    "==",
                    "3.9.1"
                ]
            ]
        },
        {
            "name": "aiofiles",
            "specs": [
                [
                    "==",
                    "23.2.1"
                ]
            ]
        }
    ],
    "lcname": "gofile2"
}
        
Elapsed time: 0.16414s