Hi! Welcome to the github of my first python package. Thanks you, and contributions are welcome.
PyBay is a package that allow you to use bayfiles.com easily in python.
Yes it is, but under MIT License
pip install pybay
from pybay import File
from pybay import File
print(File.Upload("path/of/my/file.txt", 1) # You can use 1 or 2 as a response parameter (more below...)
File.Upload() need 2 arguments
- FilePath
- Response type (1 or 2)
For Response type, 1 will return file id and 2 will return file url
1 response exemple:
n7nad3p9yf
2 response exemple:
https://bayfiles.com/n7nad3p9yf
If your file is too large (more than 5GB), PyBay will respond:
Your file is too large. Max size is 5GB
PyBay allow you to get informations about any files using his bayfiles id.
from pybay import File, Info
print("Long file URL: " + Info.Long(File.Upload("myfile.txt", 1))
print("Short file URL: " + Info.Short(File.Upload("myfile.txt", 1))
print("File's Name: " + Info.Name(File.Upload("myfile.txt", 1))
print("File's Size: " + Info.Size(File.Upload("myfile.txt", 1), 1) # In this situation, 2 can't work because it return the link and not the id.
Info.Size need 2 arguments:
- FilePath
- ResponseType For ResponseType, 1 will return file size in bytes and 2 will return file size as a readable text 1 Response exemple:
[...]
File's Size: 8
2 Response exemple:
[...]
File's Size: 8 B
If your file id is not found by PyBay, you will get this error:
This file doesn't exist, sorry.
PyBay has only 1 dependencies 🥳 ! It's only using requests !
👤 GitHub: @vodkarm
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Give a ⭐️ if this project helped you!
This package is my first, before I never created any packages. It was did in only 30 minutes, I know this code is not perfect but It work. Thanks for all <3