Documentation
This site documents version 0.2.7
and was last updated on
September 18th, 2021. This project is the result of a collaboration between
nstrydom2
and me. For more information regarding previous versions of this project,
please refer to the
changelog
which contains additional information about recent updates and changes
made to this library. You can find the official API specification
here
which we used as a reference to build this library, though the architecture
is highly customizable - it should take you only a few minutes to swap out
the API to make this code work with any other file hosting service. But if
you do, respect the terms of license agreement. If this is your first time
using this library, check out the
quickstart guide,
or browse through the
AnonFile
section to discover more features.
Table of Content
Quickstart Guide
Import the module and instantiate a new AnonFile
object. Using
the API token in the constructor is optional: passing a valid token makes it
possible to register all file uploads online. Setting the download directory
in path
is optional as well. If path
is not specified,
the current working directory will be used in its place.
from anonfile import AnonFile
from pathlib import Path
anon = AnonFile()
# upload a file and enable progressbar terminal feedback
upload = anon.upload('/home/guest/jims_paperwork.doc', progressbar=True)
print(upload.url.geturl())
# download a file and set the download directory
target_dir = Path.home().joinpath('downloads')
download = anon.download("https://anonfiles.com/9ee1jcu6u9/test_txt", path=target_dir)
print(download.file_path)
Command Line Interface
As of version 0.2.4
, this module also provides a
command line interface. If you primarily want to use anonfile
for its CLI capabilities, consider using
pipx
as opposed to pip
to install this module. Many new features
were added with version 0.2.7
, so it's always best to check
if new updates are available.
Read the help page. You can refine your search by adding a valid command in front of the help option.
anonfile --help
Download a file. You can pass more than one URL at a time, separated by
a whitespace character. The --path
option specifies the target
directory which defaults to the current working directory. In version
0.2.7
the --check
flag has been added to the CLI
that checks whether a file with the same name already exists in the target
directory. If that turns out to be true, you'll be asked for confirmation
before the download proceeds. Because this option makes an additional request,
you may want to turn it off explicitly by using the --no-check
flag when you don't care about this reassurance.
anonfile download --url https://anonfiles.com/93k5x1ucu0/test_txt
You can also use the batch file option by using plain text file that contains
at most one URL per line. The --no-logging
flag instructs
anonfile
to not log any URLs on your local log file. This
information is not shared with anyone else. In case of doubt browse the
source code and see for yourself. Don't take everything you read on the
internet at face value.
anonfile --no-logging download --batch-file urls.txt --no-check
Upload a file. The --no-verbose
flag disables the progress
bar that would otherwise have been enabled, which might be useful if you
want to run scripts in a silent mode. Similar to the download
method, you can also pass more than one file to this command.
anonfile --no-verbose upload --file homework.txt
Inspect the module version. This is important information if you'd like to submit a bug report on GitHub.
anonfile --version