-
Notifications
You must be signed in to change notification settings - Fork 8
Coding Usage
For your information:
- This is just a really basic implementation of those things :)
- Additionally, this is not actively maintained nor a current priority, so stuff like async implementations aren't added here yet, please check the docs
To begin using the bot hosting wrapper, follow these steps:
To get your Auth Key:
- Log in to your account on bot-hosting.net.
- Open your browser's console (usually by pressing F12 or Control + Shift + I).
- Navigate to the 'Console' tab.
- Paste the following code:
var token = localStorage.getItem('token'); console.log('Your Auth ID:', token);
- This will will print your auth id to the console in apostrophes
To get your API Key:
- Go to the Account API Panel.
- Create a new API Key
- Allow either all IP's or only the ip of the device/server/etc. where you are using the api wrapper
- After you're done, click on create and copy it
Import the necessary modules and define your authorization/api key:
from bot_hosting_wrapper import Account, Server, Panel
auth_id = "your_authorization_key"
api_key = "your_api_key"
acc = Account(auth_id)
serv = Server(auth_id)
panel = Panel(api_key)View Specific Server Information:
serv.get_info(selected_server_id="your_server_id")Change Server's Coding Language:
serv.change_language(server_id="your_server_id", language="example")
# Options for language: java, python, nodejs, lua, deno, nodemonDelete a Server:
serv.delete(server_id="your_server_id")Get Account Overview:
acc.about()Check If AUTH ID is Valid:
acc.id_check()Get Current Coins Amount:
acc.coins_amount()Generate a New SFTP Password:
acc.sftp_pass()Get the time until you can claim again:
acc.claimable()Returns: return { "claimable": data["claimable"], "timeLeft": data["timeLeft"] }
Get a list of all servers:
server_list = panel.get_serverlist()
print(server_list)Get the server's uuid:
uuid_by_identifier = panel.get_server_uuid(identifier="your_server_identifier")
print(f"UUID by Identifier: {uuid_by_identifier}")
uuid_by_name = panel.get_server_uuid(name="your_server_name")
print(f"UUID by Name: {uuid_by_name}")Get the server's name:
name_by_uuid = panel.get_server_name(uuid="your_server_uuid")
print(f"Name by UUID: {name_by_uuid}")
name_by_identifier = panel.get_server_name(identifier="your_server_identifier")
print(f"Name by Identifier: {name_by_identifier}")Get the server's identifier:
identifier_by_uuid = panel.get_server_identifier(uuid="your_server_uuid")
print(f"Identifier by UUID: {identifier_by_uuid}")
identifier_by_name = panel.get_server_identifier(identifier="your_server_name")
print(f"Identifier by Name: {identifier_by_name}")Retrieve the directory contents:
directory_contents = panel.get_directory(server_id="your_server_id", directory="/path/to/directory")
# directory is optional ; default is home/container
print(directory_contents)Iterating through multiple pages of the serverlist:
for page in range(1, 5): # Example: iterate through the first 4 pages
server_list = panel.get_serverlist(page=page)
print(f"Page {page}:", server_list)Check client permissions:
permissions = panel.check_permissions()
print(permissions)Check Account Info:
info = panel.check_account()
print(info)Get 2fa TOTP code:
totp = panel.get_2fa_code()
print(totp)Enable 2fa
two_factor = panel.enable_2fa(totp_code)
print(two_factor)Disable 2fa
# If you currently dont kno how to get hte password, check known issues
two_factor = panel.disable_2fa(password)
print(two-factor)