GofileIOUploader


NameGofileIOUploader JSON
Version 0.11.0 PyPI version JSON
download
home_pageNone
SummaryGofile.io uploader supporting parallel uploads
upload_time2024-05-24 01:27:11
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT License
keywords gofile upload storage parallel
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # GofileIO Uploader
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/GofileIOUploader) ![PyPI - Version](https://img.shields.io/pypi/v/GofileIOUploader)

A python script to upload files or directories to Gofile.io
Built using `asyncio`, `aiohttp`, and `tqdm`

## Supports
- Gofile accounts
- Private and public directory uploads
- Parallel uploads
- Retries
- Progress bars
- Upload logging
- Skipping duplicate uploads
- Local configs

## Usage
1. `pip install GofileIOUploader`

```
usage: gofile-upload [-h] [-t TOKEN] [-z {na,eu}] [-f FOLDER] [-d]
                     [--debug-save-js-locally | --no-debug-save-js-locally]
                     [-c CONNECTIONS] [--public | --no-public]
                     [--save | --no-save] [--use-config | --no-use-config]
                     [-r RETRIES]
                     file

Gofile.io Uploader supporting parallel uploads

positional arguments:
  file                  File or directory to look for files in to upload

optional arguments:
  -h, --help            show this help message and exit
  -t TOKEN, --token TOKEN
                        API token for your account so that you can upload to a
                        specific account/folder. You can also set the
                        GOFILE_TOKEN environment variable for this
  -z {na,eu}, --zone {na,eu}
                        Server zone to prefer uploading to
  -f FOLDER, --folder FOLDER
                        Folder to upload files to overriding the directory
                        name if used
  -d, --dry-run         Don't create folders or upload files
  --debug-save-js-locally, --no-debug-save-js-locally
                        Debug option to save the retrieved js file locally.
                        (default: False)
  -c CONNECTIONS, --connections CONNECTIONS
                        Maximum parallel uploads to do at once. (default: 6)
  --public, --no-public
                        Make all files uploaded public. By default they are
                        private and not unsharable. (default: False)
  --save, --no-save     Don't save uploaded file urls to a
                        "gofile_upload_<unixtime>.csv" file. (default: True)
  --use-config, --no-use-config
                        Whether to create and use a config file in
                        $HOME/.config/gofile_upload/config.json. (default:
                        True)
  -r RETRIES, --retries RETRIES
                        How many times to retry a failed upload. (default: 3)

```
## Details
### Duplicate Files
If you try to upload a file and it already exists then the upload will be skipped. This comparison is based on MD5 sums,
This check is based on the account being used. You can upload the same file twice to an account if different directories were specified.

### History
Configs are stored in `$HOME/.config/gofile_upload/config.json` and all successful uploads and md5 sum hashes will be saved in there.
Each time you complete an upload a `gofile_upload_<timestamp>.csv` will be created with the items uploaded and the following metadata:
`filePath,filePathMD5,fileNameMD5,uploadSuccess,code,downloadPage,fileId,fileName,guestToken,md5,parentFolder`

### Local Configuration
A local configuration can be used when you specify the `--use-config` flag
This config is saved in `$HOME/.config/gofile-upload/config.json` and contains the following options:
```json
{
  "token": "Optional[str]",
  "zone": "Optional[str]",
  "connections": "Optional[int]",
  "public": "Optional[bool]",
  "save": "Optional[bool]",
  "retries": "Optional[int]",
  "history": {
    "md5_sums": {
      "<filepath>": "<md5sum of file>"
    },
    "uploads": [
      "<upload response>"
    ]
  }
}
```
This config is loaded at runtime and combined with CLI options and defaults to make one config for the program.
The precedence for this is:
1. CLI Defaults
   - connections: 6
   - public: False
   - retries: 3
   - save: True
   - debug_save_js_locally: False
   - use_config: True
2. Local Config
3. CLI Options

The config will be saved when MD5 sums are calculated for files as well as when uploads are completed.
Configs that have a value of `None` will be omitted.

If you specify `--no-use-config` the local file will not be loaded and will not be saved to.

## Examples
Given
```
directory/
├── sample2.mkv
└── sample.mkv
```
**Upload single file anonymously** 
The file will be private

`gofile-upload directory/sample.mkv`

**Upload single file to your account and make it public**

`gofile-upload --token 123 --public directory/sample.mkv`

**Upload single file to directory `foo` in your account and make it public**

`gofile-upload --token 123 --public --folder foo directory/sample.mkv`

**Upload directory to your account and make them public**

`gofile-upload --token 123 --public directory`

**Upload directory to directory `foo` in your account and make them public**

`gofile-upload --token 123 --public --folder foo directory`

# Development
## Optional Prerequesites
- tk `sudo pacman -S base-devel tk`
- [pyenv](https://github.com/pyenv/pyenv?tab=readme-ov-file#set-up-your-shell-environment-for-pyenv)
- [pyenv-virtualenv](https://github.com/pyenv/pyenv-virtualenv?tab=readme-ov-file#installing-as-a-pyenv-plugin)

```bash
pyenv install 3.9
```

## Setup
```bash
pip install -r requirements-dev.txt
pre-commit install
```

## Packaging
This package currently uses [just](https://github.com/casey/just which is a Makefile like utility.

You must install `just` first and then you can do things like `just build` or `just release` which depend on the `justfile` to take actions.

# Improvements Wishlist
- [ ] Paid accounts support, I don't have a paid account so I can't test
- [ ] Add tests
- [ ] Use typing-extensions
- [ ] Add github runners for tests
- [ ] Recursive directory upload support

# Thanks
- https://stackoverflow.com/questions/68690141/how-to-show-progress-on-aiohttp-post-with-both-form-data-and-file
- https://github.com/londarks/Unofficial-gofile.io-API-Documentation
- https://github.com/Samridh212/File_Uploader_goFile
- https://gofile.io/api
- https://github.com/rkwyu/gofile-dl
- https://stackoverflow.com/questions/1131220/get-the-md5-hash-of-big-files-in-python
- https://packaging.python.org/en/latest/tutorials/packaging-projects/
- https://github.com/f-o

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "GofileIOUploader",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "Alex Mi <alexmi3.14@gmail.com>",
    "keywords": "gofile, upload, storage, parallel",
    "author": null,
    "author_email": "Alex Mi <alexmi3.14@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/1b/37/34b846c7f6b9078de324f7ebd4167f34e8abbeb9d28346b36d895531ed5c/gofileiouploader-0.11.0.tar.gz",
    "platform": null,
    "description": "# GofileIO Uploader\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/GofileIOUploader) ![PyPI - Version](https://img.shields.io/pypi/v/GofileIOUploader)\n\nA python script to upload files or directories to Gofile.io\nBuilt using `asyncio`, `aiohttp`, and `tqdm`\n\n## Supports\n- Gofile accounts\n- Private and public directory uploads\n- Parallel uploads\n- Retries\n- Progress bars\n- Upload logging\n- Skipping duplicate uploads\n- Local configs\n\n## Usage\n1. `pip install GofileIOUploader`\n\n```\nusage: gofile-upload [-h] [-t TOKEN] [-z {na,eu}] [-f FOLDER] [-d]\n                     [--debug-save-js-locally | --no-debug-save-js-locally]\n                     [-c CONNECTIONS] [--public | --no-public]\n                     [--save | --no-save] [--use-config | --no-use-config]\n                     [-r RETRIES]\n                     file\n\nGofile.io Uploader supporting parallel uploads\n\npositional arguments:\n  file                  File or directory to look for files in to upload\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -t TOKEN, --token TOKEN\n                        API token for your account so that you can upload to a\n                        specific account/folder. You can also set the\n                        GOFILE_TOKEN environment variable for this\n  -z {na,eu}, --zone {na,eu}\n                        Server zone to prefer uploading to\n  -f FOLDER, --folder FOLDER\n                        Folder to upload files to overriding the directory\n                        name if used\n  -d, --dry-run         Don't create folders or upload files\n  --debug-save-js-locally, --no-debug-save-js-locally\n                        Debug option to save the retrieved js file locally.\n                        (default: False)\n  -c CONNECTIONS, --connections CONNECTIONS\n                        Maximum parallel uploads to do at once. (default: 6)\n  --public, --no-public\n                        Make all files uploaded public. By default they are\n                        private and not unsharable. (default: False)\n  --save, --no-save     Don't save uploaded file urls to a\n                        \"gofile_upload_<unixtime>.csv\" file. (default: True)\n  --use-config, --no-use-config\n                        Whether to create and use a config file in\n                        $HOME/.config/gofile_upload/config.json. (default:\n                        True)\n  -r RETRIES, --retries RETRIES\n                        How many times to retry a failed upload. (default: 3)\n\n```\n## Details\n### Duplicate Files\nIf you try to upload a file and it already exists then the upload will be skipped. This comparison is based on MD5 sums,\nThis check is based on the account being used. You can upload the same file twice to an account if different directories were specified.\n\n### History\nConfigs are stored in `$HOME/.config/gofile_upload/config.json` and all successful uploads and md5 sum hashes will be saved in there.\nEach time you complete an upload a `gofile_upload_<timestamp>.csv` will be created with the items uploaded and the following metadata:\n`filePath,filePathMD5,fileNameMD5,uploadSuccess,code,downloadPage,fileId,fileName,guestToken,md5,parentFolder`\n\n### Local Configuration\nA local configuration can be used when you specify the `--use-config` flag\nThis config is saved in `$HOME/.config/gofile-upload/config.json` and contains the following options:\n```json\n{\n  \"token\": \"Optional[str]\",\n  \"zone\": \"Optional[str]\",\n  \"connections\": \"Optional[int]\",\n  \"public\": \"Optional[bool]\",\n  \"save\": \"Optional[bool]\",\n  \"retries\": \"Optional[int]\",\n  \"history\": {\n    \"md5_sums\": {\n      \"<filepath>\": \"<md5sum of file>\"\n    },\n    \"uploads\": [\n      \"<upload response>\"\n    ]\n  }\n}\n```\nThis config is loaded at runtime and combined with CLI options and defaults to make one config for the program.\nThe precedence for this is:\n1. CLI Defaults\n   - connections: 6\n   - public: False\n   - retries: 3\n   - save: True\n   - debug_save_js_locally: False\n   - use_config: True\n2. Local Config\n3. CLI Options\n\nThe config will be saved when MD5 sums are calculated for files as well as when uploads are completed.\nConfigs that have a value of `None` will be omitted.\n\nIf you specify `--no-use-config` the local file will not be loaded and will not be saved to.\n\n## Examples\nGiven\n```\ndirectory/\n\u251c\u2500\u2500 sample2.mkv\n\u2514\u2500\u2500 sample.mkv\n```\n**Upload single file anonymously** \nThe file will be private\n\n`gofile-upload directory/sample.mkv`\n\n**Upload single file to your account and make it public**\n\n`gofile-upload --token 123 --public directory/sample.mkv`\n\n**Upload single file to directory `foo` in your account and make it public**\n\n`gofile-upload --token 123 --public --folder foo directory/sample.mkv`\n\n**Upload directory to your account and make them public**\n\n`gofile-upload --token 123 --public directory`\n\n**Upload directory to directory `foo` in your account and make them public**\n\n`gofile-upload --token 123 --public --folder foo directory`\n\n# Development\n## Optional Prerequesites\n- tk `sudo pacman -S base-devel tk`\n- [pyenv](https://github.com/pyenv/pyenv?tab=readme-ov-file#set-up-your-shell-environment-for-pyenv)\n- [pyenv-virtualenv](https://github.com/pyenv/pyenv-virtualenv?tab=readme-ov-file#installing-as-a-pyenv-plugin)\n\n```bash\npyenv install 3.9\n```\n\n## Setup\n```bash\npip install -r requirements-dev.txt\npre-commit install\n```\n\n## Packaging\nThis package currently uses [just](https://github.com/casey/just which is a Makefile like utility.\n\nYou must install `just` first and then you can do things like `just build` or `just release` which depend on the `justfile` to take actions.\n\n# Improvements Wishlist\n- [ ] Paid accounts support, I don't have a paid account so I can't test\n- [ ] Add tests\n- [ ] Use typing-extensions\n- [ ] Add github runners for tests\n- [ ] Recursive directory upload support\n\n# Thanks\n- https://stackoverflow.com/questions/68690141/how-to-show-progress-on-aiohttp-post-with-both-form-data-and-file\n- https://github.com/londarks/Unofficial-gofile.io-API-Documentation\n- https://github.com/Samridh212/File_Uploader_goFile\n- https://gofile.io/api\n- https://github.com/rkwyu/gofile-dl\n- https://stackoverflow.com/questions/1131220/get-the-md5-hash-of-big-files-in-python\n- https://packaging.python.org/en/latest/tutorials/packaging-projects/\n- https://github.com/f-o\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Gofile.io uploader supporting parallel uploads",
    "version": "0.11.0",
    "project_urls": {
        "Gofile API": "https://gofile.io/api",
        "Homepage": "https://github.com/alexmi256/gofile-uploader",
        "Repository": "https://github.com/alexmi256/gofile-uploader.git",
        "Service": "https://gofile.io"
    },
    "split_keywords": [
        "gofile",
        " upload",
        " storage",
        " parallel"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a45955ebda1ae46d13ed653c2f957a4c55af671464d3c524f1b6583c87493ee5",
                "md5": "3cea76bf26ee0e2f683d3851a93c6b2d",
                "sha256": "54969ec38e8af12c35223a51ced0582e52a5512d7220516fd6288704c014d454"
            },
            "downloads": -1,
            "filename": "GofileIOUploader-0.11.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3cea76bf26ee0e2f683d3851a93c6b2d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 14945,
            "upload_time": "2024-05-24T01:27:10",
            "upload_time_iso_8601": "2024-05-24T01:27:10.466448Z",
            "url": "https://files.pythonhosted.org/packages/a4/59/55ebda1ae46d13ed653c2f957a4c55af671464d3c524f1b6583c87493ee5/GofileIOUploader-0.11.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1b3734b846c7f6b9078de324f7ebd4167f34e8abbeb9d28346b36d895531ed5c",
                "md5": "4d95bd074ff2686727d4b3de8e3f6e9a",
                "sha256": "1ce012b8a88367a2fbd5532cefb75f53e6061551ea6c78b3a8343761cacc6c9d"
            },
            "downloads": -1,
            "filename": "gofileiouploader-0.11.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4d95bd074ff2686727d4b3de8e3f6e9a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 13206,
            "upload_time": "2024-05-24T01:27:11",
            "upload_time_iso_8601": "2024-05-24T01:27:11.496105Z",
            "url": "https://files.pythonhosted.org/packages/1b/37/34b846c7f6b9078de324f7ebd4167f34e8abbeb9d28346b36d895531ed5c/gofileiouploader-0.11.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-24 01:27:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "alexmi256",
    "github_project": "gofile-uploader",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "gofileiouploader"
}
        
Elapsed time: 0.28389s