Skip to main content

DisCloud API async wrapper

Project description

Installing

pip install discloud

Dev installing

Note: need https://git-scm.com to download

pip install git+https://github.com/discloud/python-discloud-status@dev

Usage

Create client instance

import discloud
discloud_client = discloud.Client("Token")

Fetch user info

user = discloud_client.fetch_user_info()
print(f"ID: '{user.id}'")
plan = user.plan
print(f"Plan '{plan}'")
print(f"Expire date '{plan.expire_date}'")
print(f"Ends in '{plan.expires_in}'")

Fetch bot info

bot = await discloud_client.fetch_bot(bot_id=469310554108854274)
print(f"ID '{bot.id}'")
print(f"Status '{bot.status}'")
print(f"CPU '{bot.cpu}'")
print(f"Memóry '{bot.memory}'")
print(f"Memory available '{bot.memory.available}'")
print(f"Using memory '{bot.memory.using}'")
print(f"Last restart '{bot.last_restart}'")

Logs

logs = await discloud_client.fetch_logs(bot_id=ID_DO_BOT)
# or
logs = await bot.fetch_logs()

print(logs.url) # url for full logs

print(str(logs))
# or
print(logs.text) # for last 1800 chars

Restart

result = await discloud_client.restart_bot(bot_id=BOT_ID)
# or
result = await bot.restart()
print(result) # you will know if it was restarted

Commit

file = discloud.File("file.zip") # precisa ser em zip
await discloud_client.commit(bot_id=BOT_ID, file=file, restart=True)
# or
r = await bot.commit(file=file, restart=False)
print(r) # know if commit was successful

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

discloud-1.0.3a0.tar.gz (6.9 kB view details)

Uploaded Source

File details

Details for the file discloud-1.0.3a0.tar.gz.

File metadata

  • Download URL: discloud-1.0.3a0.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for discloud-1.0.3a0.tar.gz
Algorithm Hash digest
SHA256 dd50bda5f1c51730bf6e0279e25917ba50ed7be8810897c7b9f0dd52fd7ac0b5
MD5 e1f62ac78c884450f5c268ddabb6e484
BLAKE2b-256 ae00b6cc10cfad15a563128f61d69a81dc04652c037da44c4880d8f8ae341b9d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page