https://github.com/nstrydom2/anonfile-api
An unofficial Python Anonfiles.com API
https://github.com/nstrydom2/anonfile-api
anon anonfile anonfile-api anonfiles anonymous api file-download file-upload pypi python rest-client
Last synced: 2 months ago
JSON representation
An unofficial Python Anonfiles.com API
- Host: GitHub
- URL: https://github.com/nstrydom2/anonfile-api
- Owner: nstrydom2
- License: mit
- Created: 2019-02-14T18:56:45.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2026-02-03T04:09:47.000Z (5 months ago)
- Last Synced: 2026-02-03T18:09:46.619Z (5 months ago)
- Topics: anon, anonfile, anonfile-api, anonfiles, anonymous, api, file-download, file-upload, pypi, python, rest-client
- Language: Python
- Homepage:
- Size: 14.6 MB
- Stars: 64
- Watchers: 3
- Forks: 24
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Anonfiles.com Unofficial Python API
[](https://pypi.python.org/pypi/anonfile/)
[](https://github.com/nstrydom2/anonfile-api/actions/workflows/python-package.yml)
[](https://pypi.python.org/pypi/anonfile/)
[](https://pypi.python.org/pypi/anonfile/)
[](https://pypi.python.org/pypi/anonfile/)
This unofficial Python API was created to make uploading and downloading files
from https://anonfiles.com simple and effective for programming in Python. The goal of
the project is to create an intuitive library for anonymous file sharing.
## Getting Started
These instructions will get you a copy of the project up and running on your local
machine for development and testing purposes. See deployment for notes on how to
deploy the project on a live system.
### Prerequisites
Python 3.8+ is required to run this application, other than that there are no
prerequisites for the project, as the dependencies are included in the repository.
### Installing
To install the library is as simple as running
```bash
pip install anonfile
```
from the command line. To install this library in debug mode with dev dependencies, use
```bash
pip install -e .[dev]
```
instead. It is recommended to create an virtual environment prior
to installing this library. If you only intend to use this library from the CLI,
use [pipx](https://pypa.github.io/pipx/) for the installation instead:
```bash
pipx install anonfile
```
### Dev Notes
Run unit tests locally:
```bash
pytest --verbose -s [--token "REDACTED"]
```
Add the `-k test_*` option if you want to test only a single function.
## Usage
Import the module and instantiate the `AnonFile()` constructor. Setting the download
directory in `path` is optional. Using the API `token` in the constructor is optional
as well. A valid `token` registers all file uploads online, i.e. a list of all uploaded
files is made accessible to any user that [signs into your account](https://anonfiles.com/login).
```python
from anonfile import AnonFile
anon = AnonFile()
# upload a file and enable progressbar terminal feedback (off by default)
upload = anon.upload('/home/guest/jims_paperwork.doc', progressbar=True)
print(upload.url.geturl())
# download a file and set the download directory
from pathlib import Path
target_dir = Path.home().joinpath('Downloads')
download = anon.download("https://anonfiles.com/9ee1jcu6u9/test_txt", path=target_dir)
print(download.file_path)
```
And voilà, pain-free anonymous file sharing. If you want more information about
the `AnonFile` API visit [anonfiles.com](https://anonfiles.com/docs/api).
## Command Line Interface
```bash
# open help page for specific commands
anonfile [download|upload|preview|log] --help
# note: both methods expect at least one argument, but can take on more
anonfile download --url https://anonfiles.com/93k5x1ucu0/test_txt
anonfile upload --file ./test.txt
```
## Built With
* [Requests](http://docs.python-requests.org/en/master/) - Http for Humans
* [TQDM](https://github.com/tqdm/tqdm) - Fast & Extensible Progress Bars
* [anonfiles.com](https://anonfiles.com/docs/api) - AnonFiles.com REST API
## Versioning
Navigate to [tags on this repository](https://github.com/nstrydom2/anonfile-api/tags)
to see all available versions.
## Authors
| Name | Mail Address | GitHub Profile |
|------------------|-----------------------------|-----------------------------------------------|
| Nicholas Strydom | nstrydom@gmail.com | [nstrydom2](https://github.com/nstrydom2) |
See also the list of [contributors](https://github.com/nstrydom2/anonfile-api/contributors)
who participated in this project.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for more details.
## Acknowledgments
* Joseph Marie Jacquard
* Charles Babbage
* Ada Lovelace
* My Dad
* Hat tip to anyone whose code was used
* Inspiration
* etc