Fleepy - A Pythonic Fleep API Client
This is an alpha client for the Fleep API. It is compatible with Python 2.7 and 3.
As of now it is a non-opinionated library. It makes a request and returns to you always a Response object.
Response is simply a namedtuple. In that you can access attributes status_code, data, headers and cookies. So any method you call we are not wrapping it in anything but a Response.
pip install fleepy
git clone https://github.com/nicholasamorim/fleepy.git python setup.py install
The main goal of this client was to reflect the API as accurate as possible while keeping it Pythonic enough. The main thing to observe is that every slash that you see in the address of the resource you want to use, you translate that to a dot.
A couple examples:
from fleepy import Fleepy api = Fleepy() # /account/login api.account.login("firstname.lastname@example.org", "twopassword") # /conversation/create api.conversation.create(topic, emails, message) # /account/export/start api.account.export.start() # /search api.search(["A", "few", "keywords"]) # /search/prepare api.search.prepare() # /account/logout api.account.logout()
Whenever Fleep API requests you for a "list" of something (usually space or comma delimited), just use a normal Python list, the library will do what Fleep wants behind the scenes.
Creating a chat room with topic and an initial message.
The example below logins, creates a chat room with three people and sends a message. The message uses some of Fleep styling features, check them out here.
from fleepy import Fleepy api = Fleepy() api.account.login("email@example.com", "yourpassword") api.conversation.create( topic='This is a Room Topic', emails=['firstname.lastname@example.org', 'email@example.com', 'firstname.lastname@example.org'], message="""*Hello*, everyone! Something has just been posted in our Issue tracker. http://issue.tracker.com<<Go To Issue>> """) api.account.logout()
from fleepy import Fleepy api = Fleepy() api.account.login("email@example.com", "yourpassword") api.file.upload('/path/to/afile.jpg') api.account.logout()
More and proper documentation to come.
- Add more tests.
- Implement the Info handler.
- Create proper documentation.