ImperialBin is a hastebin alternative built with UI and user experience in mind.
Project description
Imperial-py README
ImperialBin is a Hastebin alternative built with UI and user experience in mind.
Connect With Us!
Endpoints
Function | Endpoint | Request Type |
---|---|---|
create_document() |
/api/document |
POST |
get_document() |
/api/document |
GET |
edit_document() |
/api/document |
PATCH |
verify() |
/api/CheckApiToken |
GET |
Example Usage
An API Token is not required, but you can't edit without one, and this is generally made with authorization in mind.
Add IMPERIAL-TOKEN
to path to set it automatically; this will get overwritten by setting one manually.
from imperial_py import Imperial
imp = Imperial()
imp.create_document("Hello World!")
# {'success': True, 'document_id': 'bmhn60klmpw', 'raw_link': 'https://www.imperialb.in/r/bmhn60klmpw', 'formatted_link': 'https://www.imperialb.in/p/bmhn60klmpw', 'expires_in': datetime.datetime(2021, 1, 29, 18, 55, 37, 725000), 'instant_delete': False}
imp.get_document("bmhn60klmpw")
# {'success': True, 'document': 'Hello World!'}
imp.edit_document("Hello From Python!", "bmhn60klmpw")
# {'success': True, 'message': 'Successfully edited the document!', 'document_id': 'phqmaxastug', 'raw_link': 'https://www.imperialb.in/r/phqmaxastug', 'formatted_link': 'https://www.imperialb.in/p/phqmaxastug', 'expires_in': datetime.datetime(2021, 2, 13, 19, 30, 54, 839000), 'instant_delete': False}
imp.get_document("bmhn60klmpw")
# {'success': True, 'document': 'Hello From Python!'}
Shorthand Functions
import imperial_py
imperial_py.create_document("Hello World!") # same as Imperial().create_document()
imperial_py.get_document("bmhn60klmpw") # same as Imperial().get_document()
# etc...
Python Exclusives
- camelCase json response is converted to snake_case
- The
expires_in
dict key gets converted from an isoformat string to a datetime object
Docs
To get full docs, refer to imperial documentation. To view what goes on with imperial-py, view the full code. Every function has docstrings and a description.
Contributing
Either send contributions in the discord or open a pull request. If you suggest a change, make sure it's backwards compatible. As of now, imperial-py is python 3.5 and up.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for imperial_py-1.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e824d87e2eb67f47260bdfb13a3c4b83a2419c51090f8425db08033ff2d1886 |
|
MD5 | 34589ee0f5d8eaea8c959752243e7dec |
|
BLAKE2b-256 | af0f201d313c82a1e9ad2a020117f9e9a758bce75f769e542338f01eba18c543 |