Name | viking-file JSON |
Version |
1.0.5
JSON |
| download |
home_page | None |
Summary | API Wrapper for ViKiNG FiLE API (https://vikingfile.com) |
upload_time | 2025-08-14 06:39:00 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.13 |
license | None |
keywords |
viking-file
vikingfile
api
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# viking-file-python
API Wrapper for [ViKiNG FiLE API](https://vikingfile.com/api)
## Features and Functionality
This Python library provides a convenient way to interact with the ViKiNG FiLE API, allowing you to:
* Upload files (both local and remote URLs).
* Delete files.
* Rename files.
* Check if a file exists.
* List files in your account.
* Manage files in specific paths/folders. .
## Prerequisites
* Python 3.13 or higher
* A ViKiNG FiLE account (if you need to upload files to your account)
## Installation Instructions
1. Install the package using pip:
```bash
pip install viking-file
```
## Usage Guide
### Initialization
Import the `VikingClient` or `AsyncVikingClient` class and initialize it with your user hash (if you want to upload
files to your account, otherwise, leave it empty for anonymous upload):
```python
from viking_file import VikingClient, AsyncVikingClient
# Synchronous client
client = VikingClient(user_hash="YOUR_USER_HASH") # Replace with your actual user hash
# Asynchronous client
async_client = AsyncVikingClient(user_hash="YOUR_USER_HASH") # Replace with your actual user hash
# also you can use context manager both synchronous and asynchronous
# with VikingClient(user_hash="YOUR_USER_HASH") as client:
# Your code here
# async with AsyncVikingClient(user_hash="YOUR_USER_HASH") as async_client:
# Your asynchronous code here
```
### Uploading a Local File (Synchronous)
```python
from viking_file import VikingClient
from pathlib import Path
client = VikingClient(user_hash="YOUR_USER_HASH")
# Upload a file
file_path = Path("path/to/your/file.txt") # Replace with the actual path to your file
uploaded_file = client.upload_file(
filepath=file_path,
path="Optional/Path/On/Server"
) # path argument is optional
print(f"Uploaded file hash: {uploaded_file.hash}")
print(f"Uploaded file name: {uploaded_file.name}")
print(f"Uploaded file URL: {uploaded_file.url}")
```
### Uploading a Local File (Asynchronous)
```python
import asyncio
from viking_file import AsyncVikingClient
from pathlib import Path
async def upload_file():
client = AsyncVikingClient(user_hash="YOUR_USER_HASH")
# Upload a file
file_path = Path("path/to/your/file.txt") # Replace with the actual path to your file
uploaded_file = await client.upload_file(
filepath=file_path,
path="Optional/Path/On/Server"
) # path argument is optional
print(f"Uploaded file hash: {uploaded_file.hash}")
print(f"Uploaded file name: {uploaded_file.name}")
print(f"Uploaded file URL: {uploaded_file.url}")
asyncio.run(upload_file())
```
### Uploading a Remote File (Asynchronous)
```python
import asyncio
from viking_file import AsyncVikingClient
async def upload_remote_file():
client = AsyncVikingClient(user_hash="YOUR_USER_HASH")
# Upload a remote file
remote_url = "https://example.com/remote_file.zip" # Replace with the actual URL
uploaded_file = await client.upload_remote_file(
url=remote_url,
filename="new_name.zip",
path="Optional/Path/On/Server"
) # filename and path arguments are optional
print(f"Uploaded file hash: {uploaded_file.hash}")
print(f"Uploaded file name: {uploaded_file.name}")
print(f"Uploaded file URL: {uploaded_file.url}")
asyncio.run(upload_remote_file())
```
### Deleting a File (Asynchronous)
```python
import asyncio
from viking_file import AsyncVikingClient
async def delete_file():
client = AsyncVikingClient(user_hash="YOUR_USER_HASH")
# Delete a file
file_hash = "FILE_HASH_TO_DELETE" # Replace with the actual file hash
await client.delete_file(file_hash)
print(f"File {file_hash} deleted successfully.")
asyncio.run(delete_file())
```
### Renaming a File (Asynchronous)
```python
import asyncio
from viking_file import AsyncVikingClient
async def rename_file():
client = AsyncVikingClient(user_hash="YOUR_USER_HASH")
# Rename a file
file_hash = "FILE_HASH_TO_RENAME" # Replace with the actual file hash
new_filename = "new_file_name.txt"
await client.rename_file(file_hash, new_filename)
print(f"File {file_hash} renamed to {new_filename} successfully.")
asyncio.run(rename_file())
```
### Listing Files (Asynchronous)
```python
import asyncio
from viking_file import AsyncVikingClient
async def list_files():
client = AsyncVikingClient(user_hash="YOUR_USER_HASH")
# List files on page 1
page_number = 1
files = await client.list_files(
page=page_number,
path="Optional/Path/On/Server"
) # path argument is optional
for file in files:
print(f"File Hash: {file.hash}, Name: {file.name}, Size: {file.size}, URL: {file.url}")
asyncio.run(list_files())
```
### Listing all files (Asynchronous)
```python
import asyncio
from viking_file import AsyncVikingClient
async def list_all_files():
client = AsyncVikingClient(user_hash="YOUR_USER_HASH")
# List all files
files = await client.list_all_files(
path="Optional/Path/On/Server"
) # path argument is optional
for file in files:
print(f"File Hash: {file.hash}, Name: {file.name}, Size: {file.size}, URL: {file.url}")
asyncio.run(list_all_files())
```
### Getting File Information (Asynchronous)
```python
import asyncio
from viking_file import AsyncVikingClient
async def get_file_information():
client = AsyncVikingClient(user_hash="YOUR_USER_HASH")
# Get file information
file_hash = "FILE_HASH_TO_GET_INFO" # Replace with the actual file hash
file = await client.get_file(file_hash)
asyncio.run(get_file_information())
```
## API
The `viking_file/api.py` file contains the low-level API functions that are used by the `VikingClient` and
`AsyncVikingClient` classes. These functions are primarily intended for internal use but can be used directly if needed.
## Contributing Guidelines
Contributions are welcome! To contribute:
1. Fork the repository.
2. Create a new branch for your feature or bug fix.
3. Implement your changes.
4. Write tests for your changes.
5. Ensure all tests pass.
6. Submit a pull request.
## License Information
This project is licensed under the [MIT License](https://github.com/arabianq/viking-file-python/blob/main/LICENSE)
## Contact/Support Information
For questions, bug reports, or feature requests, please open an issue on
the [GitHub repository](https://github.com/arabianq/viking-file-python).
Raw data
{
"_id": null,
"home_page": null,
"name": "viking-file",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.13",
"maintainer_email": null,
"keywords": "viking-file, vikingfile, api",
"author": null,
"author_email": "arabianq <a.tevg@ya.ru>",
"download_url": "https://files.pythonhosted.org/packages/47/2b/1b1bcbf291249494fe40006c98a70c7d4677be5fa56a98102e64d80ad893/viking_file-1.0.5.tar.gz",
"platform": null,
"description": "# viking-file-python\n\nAPI Wrapper for [ViKiNG FiLE API](https://vikingfile.com/api)\n\n## Features and Functionality\n\nThis Python library provides a convenient way to interact with the ViKiNG FiLE API, allowing you to:\n\n* Upload files (both local and remote URLs).\n* Delete files.\n* Rename files.\n* Check if a file exists.\n* List files in your account.\n* Manage files in specific paths/folders. .\n\n## Prerequisites\n\n* Python 3.13 or higher\n* A ViKiNG FiLE account (if you need to upload files to your account)\n\n## Installation Instructions\n\n1. Install the package using pip:\n\n ```bash\n pip install viking-file\n ```\n\n## Usage Guide\n\n### Initialization\n\nImport the `VikingClient` or `AsyncVikingClient` class and initialize it with your user hash (if you want to upload\nfiles to your account, otherwise, leave it empty for anonymous upload):\n\n```python\nfrom viking_file import VikingClient, AsyncVikingClient\n\n# Synchronous client\nclient = VikingClient(user_hash=\"YOUR_USER_HASH\") # Replace with your actual user hash\n\n# Asynchronous client\nasync_client = AsyncVikingClient(user_hash=\"YOUR_USER_HASH\") # Replace with your actual user hash\n\n# also you can use context manager both synchronous and asynchronous\n\n# with VikingClient(user_hash=\"YOUR_USER_HASH\") as client:\n # Your code here\n\n# async with AsyncVikingClient(user_hash=\"YOUR_USER_HASH\") as async_client:\n # Your asynchronous code here\n```\n\n### Uploading a Local File (Synchronous)\n\n```python\nfrom viking_file import VikingClient\nfrom pathlib import Path\n\nclient = VikingClient(user_hash=\"YOUR_USER_HASH\")\n\n# Upload a file\nfile_path = Path(\"path/to/your/file.txt\") # Replace with the actual path to your file\nuploaded_file = client.upload_file(\n filepath=file_path,\n path=\"Optional/Path/On/Server\"\n) # path argument is optional\n\nprint(f\"Uploaded file hash: {uploaded_file.hash}\")\nprint(f\"Uploaded file name: {uploaded_file.name}\")\nprint(f\"Uploaded file URL: {uploaded_file.url}\")\n```\n\n### Uploading a Local File (Asynchronous)\n\n```python\nimport asyncio\nfrom viking_file import AsyncVikingClient\nfrom pathlib import Path\n\n\nasync def upload_file():\n client = AsyncVikingClient(user_hash=\"YOUR_USER_HASH\")\n\n # Upload a file\n file_path = Path(\"path/to/your/file.txt\") # Replace with the actual path to your file\n uploaded_file = await client.upload_file(\n filepath=file_path,\n path=\"Optional/Path/On/Server\"\n ) # path argument is optional\n\n print(f\"Uploaded file hash: {uploaded_file.hash}\")\n print(f\"Uploaded file name: {uploaded_file.name}\")\n print(f\"Uploaded file URL: {uploaded_file.url}\")\n\n\nasyncio.run(upload_file())\n```\n\n### Uploading a Remote File (Asynchronous)\n\n```python\nimport asyncio\nfrom viking_file import AsyncVikingClient\n\n\nasync def upload_remote_file():\n client = AsyncVikingClient(user_hash=\"YOUR_USER_HASH\")\n\n # Upload a remote file\n remote_url = \"https://example.com/remote_file.zip\" # Replace with the actual URL\n uploaded_file = await client.upload_remote_file(\n url=remote_url,\n filename=\"new_name.zip\",\n path=\"Optional/Path/On/Server\"\n ) # filename and path arguments are optional\n\n print(f\"Uploaded file hash: {uploaded_file.hash}\")\n print(f\"Uploaded file name: {uploaded_file.name}\")\n print(f\"Uploaded file URL: {uploaded_file.url}\")\n\n\nasyncio.run(upload_remote_file())\n```\n\n### Deleting a File (Asynchronous)\n\n```python\nimport asyncio\nfrom viking_file import AsyncVikingClient\n\n\nasync def delete_file():\n client = AsyncVikingClient(user_hash=\"YOUR_USER_HASH\")\n\n # Delete a file\n file_hash = \"FILE_HASH_TO_DELETE\" # Replace with the actual file hash\n await client.delete_file(file_hash)\n\n print(f\"File {file_hash} deleted successfully.\")\n\n\nasyncio.run(delete_file())\n```\n\n### Renaming a File (Asynchronous)\n\n```python\nimport asyncio\nfrom viking_file import AsyncVikingClient\n\n\nasync def rename_file():\n client = AsyncVikingClient(user_hash=\"YOUR_USER_HASH\")\n\n # Rename a file\n file_hash = \"FILE_HASH_TO_RENAME\" # Replace with the actual file hash\n new_filename = \"new_file_name.txt\"\n await client.rename_file(file_hash, new_filename)\n\n print(f\"File {file_hash} renamed to {new_filename} successfully.\")\n\n\nasyncio.run(rename_file())\n```\n\n### Listing Files (Asynchronous)\n\n```python\nimport asyncio\nfrom viking_file import AsyncVikingClient\n\n\nasync def list_files():\n client = AsyncVikingClient(user_hash=\"YOUR_USER_HASH\")\n\n # List files on page 1\n page_number = 1\n files = await client.list_files(\n page=page_number,\n path=\"Optional/Path/On/Server\"\n ) # path argument is optional\n\n for file in files:\n print(f\"File Hash: {file.hash}, Name: {file.name}, Size: {file.size}, URL: {file.url}\")\n\n\nasyncio.run(list_files())\n```\n\n### Listing all files (Asynchronous)\n\n```python\nimport asyncio\nfrom viking_file import AsyncVikingClient\n\n\nasync def list_all_files():\n client = AsyncVikingClient(user_hash=\"YOUR_USER_HASH\")\n\n # List all files\n files = await client.list_all_files(\n path=\"Optional/Path/On/Server\"\n ) # path argument is optional\n\n for file in files:\n print(f\"File Hash: {file.hash}, Name: {file.name}, Size: {file.size}, URL: {file.url}\")\n\n\nasyncio.run(list_all_files())\n```\n\n### Getting File Information (Asynchronous)\n\n```python\nimport asyncio\nfrom viking_file import AsyncVikingClient\n\n\nasync def get_file_information():\n client = AsyncVikingClient(user_hash=\"YOUR_USER_HASH\")\n\n # Get file information\n file_hash = \"FILE_HASH_TO_GET_INFO\" # Replace with the actual file hash\n file = await client.get_file(file_hash)\n\n\nasyncio.run(get_file_information())\n```\n\n## API\n\nThe `viking_file/api.py` file contains the low-level API functions that are used by the `VikingClient` and\n`AsyncVikingClient` classes. These functions are primarily intended for internal use but can be used directly if needed.\n\n## Contributing Guidelines\n\nContributions are welcome! To contribute:\n\n1. Fork the repository.\n2. Create a new branch for your feature or bug fix.\n3. Implement your changes.\n4. Write tests for your changes.\n5. Ensure all tests pass.\n6. Submit a pull request.\n\n## License Information\n\nThis project is licensed under the [MIT License](https://github.com/arabianq/viking-file-python/blob/main/LICENSE)\n\n## Contact/Support Information\n\nFor questions, bug reports, or feature requests, please open an issue on\nthe [GitHub repository](https://github.com/arabianq/viking-file-python).\n",
"bugtrack_url": null,
"license": null,
"summary": "API Wrapper for ViKiNG FiLE API (https://vikingfile.com)",
"version": "1.0.5",
"project_urls": {
"Documentation": "https://github.com/arabianq/viking-file-python",
"Releases": "https://pypi.org/project/viking-file/#history",
"Repository": "https://github.com/arabianq/viking-file-python"
},
"split_keywords": [
"viking-file",
" vikingfile",
" api"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "2b2eba6b847fa9a4e6579a4dfef5ce0a43b204db87cfc0cd85c6146e30344402",
"md5": "1abe2f50a76ca5014d64caf070b31920",
"sha256": "35beff0ecbe7f77004daba45470cafe659d3b375f7a4644a89620e9de92b8be3"
},
"downloads": -1,
"filename": "viking_file-1.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1abe2f50a76ca5014d64caf070b31920",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.13",
"size": 10873,
"upload_time": "2025-08-14T06:38:59",
"upload_time_iso_8601": "2025-08-14T06:38:59.483151Z",
"url": "https://files.pythonhosted.org/packages/2b/2e/ba6b847fa9a4e6579a4dfef5ce0a43b204db87cfc0cd85c6146e30344402/viking_file-1.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "472b1b1bcbf291249494fe40006c98a70c7d4677be5fa56a98102e64d80ad893",
"md5": "6d6a27d33c606896852457af4b559df4",
"sha256": "06462cfd8741923311562f2c438eb105412a35399aa6162c8eec4df3cf20a6da"
},
"downloads": -1,
"filename": "viking_file-1.0.5.tar.gz",
"has_sig": false,
"md5_digest": "6d6a27d33c606896852457af4b559df4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.13",
"size": 10996,
"upload_time": "2025-08-14T06:39:00",
"upload_time_iso_8601": "2025-08-14T06:39:00.699479Z",
"url": "https://files.pythonhosted.org/packages/47/2b/1b1bcbf291249494fe40006c98a70c7d4677be5fa56a98102e64d80ad893/viking_file-1.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-14 06:39:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "arabianq",
"github_project": "viking-file-python",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "viking-file"
}