StrawPy 1.1
StrawPy is a python wrapper for Strawpoll.
Table of Contents
Obtaining StrawPy
You can get Pyhorizon using pip install:
pip install strawpy
OR:
Going here , downloading the zip file and running the setup file:
python setup.py install
Using StrawPy
You can get a response from an existing poll or create a new one using Strawpy.
import strawpy
Get Poll
Send a get request to the Strawpoll API based on a poll ID. Returns a StrawPoll class object.
poll = strawpy.get_poll('11682852')
Create Poll
Send a post request to the Strawpoll API based poll data parameters. Returns a StrawPoll class object.
new_poll = strawpy.create_poll('Is Python the best?', ['Yes', 'No'])
StrawPoll Class
A strawpy.StrawPoll class is returned from a successful get_poll or create_poll function.
- app_version
- assets_headers
- assets_url
- environment
- key
- password
- ticket_url
- token
- user_url
- username
- url
- open(results=False)
- refresh()
poll = strawpy.get_poll('11682852')
print poll
print poll.id
print poll.title
print poll.votes
print poll.options
print poll.captcha
print poll.dupcheck
print poll.results
print poll.results_with_percent
print poll.url
print poll.results_url
poll.refresh()
poll.open(results=False)
Changelog
1.1 (2016-12-7)
- Added url attribute to StrawPoll class objects.
- Added results_url to StrawPoll class objects.
- Added refresh method to StrawPoll class objects.
1.0 (2016-11-18)
- Initial release.
Attribution
StrawPy isn't endorsed by Strawpoll and doesn't reflect the views or opinions of Strawpoll or anyone officially involved in producing or managing Strawpoll or the Strawpoll API.
License
The MIT License (MIT)