Api Module for https://bubblez.app/ and websockets
Project description
Bubblez.py - Api Module for Bubblez.app
A Python Module for the Bubblez.app api
- Bubblez.app has approved Bubblez.py
Version's
- Python: Github Bubblez.py
- PyPi: Bubblez.py
- Nodejs: Bubblez.js
- Nodejs Wiki/Documentation: Wiki/Documentation
- Website: Bubblez.app
Setup
Pip install:
pip install bubblez.py
Required modules: requests
$ python3 -m pip install requests
Examples
Check the examples.py file above!
Docs
Basic Client Setup:
If u do not have a token: Request your token at: https://bubblez.app/applications/api-token'
from Bubblez import Bubblez
client = Bubblez("Your Username", "your token")
Basic Client Setup with websockets:
from Bubblez import Bubblez
from Bubblez import Socket, Events
client = Bubblez("Your Username", "your token")
socket = Socket(client)
@socket.on(Events.NewDevlog)
def new_devlog(devlog):
devlog = {
"200": "latest Blog Post",
"blogid": "",
"blogposter_username": "",
"blogposter_displayname": "",
"blogposter_pfp": "",
"blogcontent": "",
"blogdate": "1990-01-01 00:00:00"
}
@socket.on(Events.NewPost)
def new_post(post):
post = {
"200": "Found post",
"postid": "....",
"username": "....",
"pfp": "https://cds.bubblez.app/v2/get/bblz_606df57511f60/display/256",
"content": "why is working not working? \r\n",
"from": None,
"locked": "false",
"pnsfw": "false",
"edited": None,
"post_date": "2021-11-02 14:59:46",
"replies": [
{
"replyid": "....",
"username": "MeeSoS",
"pfp": "https://cds.bubblez.app/v2/get/bblz_606df57511f60/display/256",
"content": "or is it?",
"from": None,
"rnsfw": None,
"deleted": None,
"edit_date": None,
"reply_date": "2021-11-02 15:01:00"
},
{
"replyid": "....",
"username": "MeeSoS",
"pfp": "https://cds.bubblez.app/v2/get/bblz_606df57511f60/display/256",
"content": "this is test\r\n",
"from": None,
"rnsfw": None,
"deleted": None,
"edit_date": None,
"reply_date": "2021-11-02 16:06:15"
}
]
}
@socket.on(Events.NewReply)
def new_post(post, reply):
post = {
"200": "Found post",
"postid": "....",
"username": "....",
"pfp": "https://cds.bubblez.app/v2/get/bblz_606df57511f60/display/256",
"content": "why is working not working? \r\n",
"from": None,
"locked": "false",
"pnsfw": "false",
"edited": None,
"post_date": "2021-11-02 14:59:46",
"replies": [
{
"replyid": "....",
"username": "MeeSoS",
"pfp": "https://cds.bubblez.app/v2/get/bblz_606df57511f60/display/256",
"content": "or is it?",
"from": None,
"rnsfw": None,
"deleted": None,
"edit_date": None,
"reply_date": "2021-11-02 15:01:00"
},
{
"replyid": "....",
"username": "MeeSoS",
"pfp": "https://cds.bubblez.app/v2/get/bblz_606df57511f60/display/256",
"content": "this is test\r\n",
"from": None,
"rnsfw": None,
"deleted": None,
"edit_date": None,
"reply_date": "2021-11-02 16:06:15"
}
]
}
reply = {
"replyid": "....",
"username": "MeeSoS",
"pfp": "https://cds.bubblez.app/v2/get/bblz_606df57511f60/display/256",
"content": "this is test\r\n",
"from": None,
"rnsfw": None,
"deleted": None,
"edit_date": None,
"reply_date": "2021-11-02 16:06:15"
}
socket.connect()
User stuff:
checkUser()
client.user.checkUser()
The response:
{
"200": "Found user",
"uuid": None,
"username": "DarkMatter",
"displayname": "DarkMatter",
"email": "zakygames701@gmail.com",
"pfp": "https://i.imgur.com/jAOd5gE.png",
"banner": "https://i.imgur.com/1bZdeBF.png",
"coins": "85",
"rank": "founder",
"eventr": "darkmatter",
"patreon": "true",
"booster": "true",
"bio": "We don't know much about them, but we're sure DarkMatter is great.",
"nsfw": "false",
"dob": None,
"pronoun": "hehim",
"ban": None,
"created_at": "2019-10-21 07:40:23",
"last_posted": "2021-07-30 01:19:36",
"posts": [
{
"postid": "522",
"username": "DarkMatter",
"nsfw": "false",
"content": "API is cool",
"from": "API testing",
"locked": "false",
"edited": None,
"post_date": "2021-07-30 12:18:31"
}
],
"replies": [
{
"replyid": "1473",
"postid": "522",
"username": "DarkMatter",
"nsfw": "false",
"content": "Cool reply with the API",
"from": "API testing",
"edited": None,
"reply_date": "2021-07-30 12:49:12"
}
]
}
pingUser()
client.user.pingUser()
The response:
{
"200": "Pong",
"username": "DarkMatter",
"online_status": "2021-07-30 13:03:18"
}
getUser()
client.user.getUser()
The response:
{
"200": "Found user",
"uuid": null,
"username": "embed",
"displayname": "embed",
"followers": 2,
"pfp": "https://i.imgur.com/Md5C3uy.gif",
"banner": null,
"coins": "0",
"rank": "founder",
"eventr": "lgbt19",
"patreon": "true",
"booster": "true",
"bio": "the best bubblez dev.",
"nsfw": "false",
"pronoun": "none",
"ban": null,
"created_at": "2019-10-22 12:04:01",
"last_posted": null,
"posts": [
{
"postid": "280",
"username": "embed",
"nsfw": "false",
"content": "gamimg",
"from": null,
"locked": "false",
"edited": null,
"post_date": "2020-08-09 17:15:19"
}
]
}
Posts stuff:
sendPost()
client.post.sendPost(
message="The best Website is:...",
from_="This Beauti Python Program",
locked=True or False,
nsfw=True or False,
)
The response:
{
"200": "message sent",
"post": "API is cool",
"from": "API testing",
"locked": "false",
"pnsfw": "false",
"postid": 522
}
editPost()
client.post.editPost(
new_message='The edited message',
postid=1234
)
The response:
{
"200": "Post 522 has been updated"
}
getPost()
client.post.getPost(
postid=...
)
The response:
{
"200": "Found post",
"postid": "522",
"username": "DarkMatter",
"pfp": "https://i.imgur.com/jAOd5gE.png",
"nsfw": "false",
"content": "API is cool",
"from": "API testing",
"locked": "false",
"edited": null,
"post_date": "2021-07-30 12:18:31",
"replies": [
{
"replyid": "1473",
"username": "DarkMatter",
"pfp": "https://i.imgur.com/jAOd5gE.png",
"content": "Cool reply with the API",
"from": null,
"deleted": null,
"edit_date": null,
"reply_date": "2021-07-30 12:49:12"
}
]
}
deletePost()
client.post.deletePost(
postid=...
)
The response:
{
"200": "Post 522 has been deleted"
}
lockPost()
client.post.lockPost(
postid=...,
locked=True or False
)
The response:
{
"200": "Post 522 has been locked"
}
or
{
"200": "Post 522 has been unlocked"
}
getLatestPost() Global
client.post.getLatestPost(
postid_only=True or False
)
The response:
{
"200": "latest Post",
"postid": "522"
}
Reply's:
sendReply()
client.reply.sendReply(
postid=...,
message="The beauti reply on this beauti message..",
from_="from python",
nsfw=True or False
)
The response:
{
"200": "reply sent",
"reply": "Cool reply with the API",
"postid": "522",
"from": "API testing",
"rnsfw": "false",
"replyid": 1473
}
deleteReply()
client.reply.deleteReply(
replyid=...
)
The response:
{
"200": "reply 1473 has been deleted"
}
editReply()
client.reply.editReply(
replyid=...,
new_reply="edited reply"
)
The response:
{
"200": "Reply 1473 has been updated"
}
Blog:
getLatest()
client.blog.getLatest()
The response:
{
"200": "latest Blog Post",
"blogid": "",
"blogposter_username": "",
"blogposter_displayname": "",
"blogposter_pfp": "",
"blogcontent": "",
"blogdate": "1990-01-01 00:00:00"
}
Websockets
A full websocket lisener:
client = Bubblez("username", "token",)
socket = Socket(client)
@socket.on(Socket.Events.NewPost)
def new_post(post):
print(post)
@socket.on(Socket.Events.NewReply)
def new_reply(post, reply):
print(post, reply)
@socket.on(Socket.Events.NewDevlog)
def new_devlog(devlog):
print(devlog)
socket.connect()
If you use windows and websockets give a SSL error:
socket.connect(verify=False)
Note
:
This is vulnerable for man-in-middle attacks!!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Bubblez.py-0.0.4.2.2.tar.gz
(9.7 kB
view hashes)
Built Distribution
Close
Hashes for Bubblez.py-0.0.4.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8dc2532bbbbd444953b53cf23587f2d563f9043cbb1f0ca8e043781ad42c6a2d |
|
MD5 | d137191a98c3e699c401e5a8a4cdcda1 |
|
BLAKE2b-256 | 3b6a6ec0277c572b57fc0eefb600d3a72212763c176e44f108362f6e9fcc8a91 |