Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/msabramo/volafile-api
API for Volafile.io in Python 3
https://github.com/msabramo/volafile-api
Last synced: about 1 month ago
JSON representation
API for Volafile.io in Python 3
- Host: GitHub
- URL: https://github.com/msabramo/volafile-api
- Owner: msabramo
- License: gpl-3.0
- Created: 2015-01-11T02:08:19.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-01-11T05:40:12.000Z (almost 10 years ago)
- Last Synced: 2024-05-09T20:38:33.835Z (8 months ago)
- Language: Python
- Homepage: https://volafile.io/r/BEEPi
- Size: 293 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
=====================
Volafile API (volapi)
=====================Installation
------------
::pip3 install volapi
Examples
-------Basic
~~~~~
.. code-block:: python# Import volapi and a Room interface
from volapi import Room
# beepi will close at the end of this scope
with Room("BEEPi", "ptc") as beepi:
# optional login using a password
beepi.user.login("hunter2")
# Upload a file under a new filename and save the id
id = beepi.upload_file("images/disgusted.jpg", upload_as="mfw.jpg")
# Show off your file in the chat
beepi.post_chat("mfw posting from volapi @{}".format(id))
# Print out chat messages since you got to the room
for msg in beepi.chat_log:
print(msg.nick + ": " + msg.msg)Listening
~~~~~~~~~~Some basic trolling can be archieved with just a few lines of code.
.. code-block:: python
from volapi import Room, listen_many
with Room("BEEPi", "Stallman") as BEEPi:
def interject(msg):
if "linux" in msg.msg.lower() and msg.nick != room.user.name:
room.post_chat("Don't you mean GNU/Linux?")
BEEPi.add_listener("chat", interject)
BEEPi.listen()You can troll more than one room in parallel:
.. code-block:: python
from functools import partial
from volapi import Room, listen_manywith Room("BEEPi", "Stallman") as BEEPi, Room("HvoXwS", "Popman") as HvoXwS:
def interjectBEEPi(msg, room):
if "linux" in msg.msg.lower() and msg.nick != room.user.name:
room.post_chat("Don't you mean GNU/Linux?")
def interjectHvoXwS(msg, room):
if "hollywood" in msg.msg.lower() and msg.nick != room.user.name:
room.post_chat("Don't you mean GNU/Hollywood?")
BEEPi.add_listener("chat", partial(interjectBEEPi, room=BEEPi))
HvoXwS.add_listener("chat", partial(interjectHvoXwS, room=HvoXwS))
listen_many(BEEPi, HvoXwS)