Strawpoll Api

S

HTTP Rotating & Static Proxies

  • 200 thousand IPs
  • Locations: US, EU
  • Monthly price: from $39
  • 1 day moneyback guarantee

Visit stormproxies.com

API reference — strawpoll.py 0.2.0 documentation

API reference — strawpoll.py 0.2.0 documentation

API reference — 0. 2. 0 documentation
An async python wrapper for the Strawpoll API.
Version info¶
rsion_info¶
A named tuple containing the five components of the version number in a
similar manner as rsion_info.
strawpoll. __version__¶
A string representation of version_info.
API¶
class (*, loop=None, requests_policy=
Represents the strawpoll API.
Parameters:loop – The event loop to use for the asynchronous calls. Defaults to None, which will grab the default event loop instead.
get_poll(arg, *, request_policy=None)¶
Retrieves a poll from strawpoll.
Parameters:
arg – Either the ID of the poll or its strawpoll url.
request_policy (Optional[RequestsPolicy]) – Overrides quests_policy for that request.
Raises:HTTPException – Requesting the poll failed.
Returns:A poll constructed with the requested data.
Return type:Poll
submit_poll(poll, *, request_policy=None)¶
Submits a poll on strawpoll.
poll (Poll) – The poll to submit.
Raises:
ExistingPoll – This poll instance has already been submitted.
HTTPException – The submission failed.
Returns:The given poll updated with the data sent back from the submission.
Note
Only polls that have a non empty title and between 2 and 30 options
can be submitted.
class questsPolicy¶
An enumeration of the requests’ policies.
asynchronous = 0¶
The asynchronous policy.
synchronous = 1¶
The synchronous policy.
Poll¶
class (title, options, **kwargs)¶
Represents a poll from strawpoll.
title (str) – The question that the poll is asking.
options (iterable) – An iterable of elements accepting the str() operation.
Variables:
id (int) – The poll ID on strawpoll. If the poll has not been submitted on or retrieved from strawpoll, it’s None instead.
multi (bool) – Specifies if the polls accepts multiple votes from one user. Defaults to False.
dupcheck (str) – Defines how to handle checking for duplicate votes. Defaults to normal.
captcha (bool) – Specifies if the poll requires users to pass a captcha to vote. Defaults to False.
options¶
Returns a list of strings to represent the options for the poll, in
the order they were given when the poll was created.
votes¶
Return a list of integers that correspond to the same indexed option
which specify the current votes for that option.
total_votes¶
Returns the total number of votes on the poll.
url¶
Returns the url of the poll. If the poll has not been submitted yet,
an empty string is returned instead.
results(limit=None)¶
Returns a list of tuples each containing a string representing an
option and an int which specify the current votes for that option,
ordered by their votes count.
Parameters:limit (int) – The maximum number of results to return. If not specified, every results will be returned.
result_at(index)¶
Returns a tuple containing a string representing the option and an
int which specify the current votes for that option.
Parameters:index (int) – The index of the wanted option in the options list.
Exceptions¶
exception rawpollException¶
Base class of all the other exceptions in
exception strawpoll. ExistingPoll¶
Exception thrown when an attempt to submit a poll that already has been submitted is made.
exception TPException(response, data)¶
Exception thrown when an HTTP request failed.
response (ientResponse) – The failed HTTP request’s response.
text (str) – The error message extracted from the response. Can be an empty string.
code (int) – The error code extracted from the response. Can be 0 if no error code was found.
Samuel-Maddock/StrawPoll-Java-API - GitHub

VPN

  • No logs
  • Kill Switch
  • 6 devices
  • Monthly price: $4.92

Visit nordvpn.com

Samuel-Maddock/StrawPoll-Java-API – GitHub

A Lightweight Java API Wrapper for
Getting Started
Prerequisites
In order to use this API wrapper, it requires the GSON Library for JSON manipulation. If you are not using maven or gradle then you will need to have this installed along with this libraries
Installing via Maven
If you are using maven or gradle you do not need to worry about installing GSON.
This library is available through JitPack. If you are building your project through Maven you need to add the following to your
First the jitpack repository






Then the dependency of the project itself



StrawPoll-Java-API
1. 0. 4


If you are using gradle check the JitPack info here!
Examples
Quickly Creating a StrawPoll:
Creating a StrawPoll is very simple. There are multiple ways to do this.
The easiest way is to pass the StrawPoll object all of its data at construction. You can quickly create a StrawPoll by passing it a title (the question of the poll) and a list of options that users will vote for.
Once the data has been added to the poll, you need to call the create() method to send a request to the StrawPoll API to create the poll.
StrawPoll strawPoll = new StrawPoll(“StrawPoll Title”, “Option 1”, “Option 2”);
(); //Creates the StrawPoll, by sending a request to the API
After the StrawPoll has been created, the StrawPoll object will have been updated with the poll’s id, the url of the poll and the votes of the poll.
(); //Will retrieve the id of the poll.
tPollURL(); //Will return the full string url of the poll that has been created. You can view this poll in your browser.
tVotes(); //Returns a List of the votes for each option. Obviously after creation these are all 0.
NOTE: In order to create a StrawPoll, you must include a title and at least one option.
The StrawPoll constructor also allows for more freedom. You can pass a List of options instead.
List options = new ArrayList<>();
(“Option 1”);
(“Option 2”);
StrawPoll strawPoll = new StrawPoll(“This is my Poll”, options);
();
NOTE: The StrawPoll API has a limitation on the number of options that it can use. There is a maximum of 30 options per poll.
If you wish for the poll to allow multiple votes from the same user or to have a captcha to verify that users are actually humans you can use the full constructor to create a poll.
The format of the full constructor is as follows:
StrawPoll strawPoll = new StrawPoll(title, options, isMulti, hasCaptcha, DupCheck);
Constructor Parameters:
title – The title of the StrawPoll
options – The list of options as a List
isMulti – A boolean that determines if a user is allowed to vote multiple times. If true, then the same person can vote multiple times. This is false by default.
hasCaptcha – A boolean that determines if there is a captcha to verify if a user is human. True enables the captcha. This is false by default.
DupCheck – This is an enum of DupCheckType that determines the type of duplication checking to be used. This is by default
DupCheck has three different values:
– This is the normal duplication checking. This is enabled by default
RMISSIVE – This makes the poll more lenient in vote duplication checking.
DupCheckType. DISABLED – This disables duplication checking for the poll.
You can also easily clone StrawPoll objects by doing the following:
StrawPoll strawPoll = new StrawPoll(“Title”, “Option1”, “Option2”);
StrawPoll pollCopy = new StrawPoll(strawPoll);
Updating and Retrieving a StrawPoll
If you want to retrieve data from a StrawPoll with a known URL or Poll ID then you can call the retrieve() method or create a new poll by passing a valid strawpoll URL to the constructor
StrawPoll poll = new StrawPoll();
poll = trieve(“); //Retrieves strawpoll with id 1
StrawPoll strawPoll = new StrawPoll(1); //Retrieves strawpoll with id 1
StrawPoll myPoll = new StrawPoll(“); //Retrieves strawpoll with id 1
You can then retrieve information about the poll using it’s getters:
(); //String id of the poll
tTitle(); //String title of the poll
tOptions(); //List of options
tVotes(); //List of votes
Multi(); //Boolean
strawPoll. hasCaptcha(); //Boolean
tDupCheck(); //Enum of type DupCheckType
tPollURL(); //URL of the StrawPoll
If you want to update a StrawPoll’s information (eg the number of votes) then simply call the update() method.
StrawPoll myPoll = new StrawPoll(“Is StrawPoll good? “, “Yes”, “No”);
(); //Votes are [0, 0]
// The following is called after someone has voted on the poll eg two people vote yes, one votes no
tVotes(); //Votes are [2, 1]
Using Setters to Create a Poll
Most StrawPoll fields have setters which you can use instead of the constructor.
These methods support method chaining which allow us to create a poll like this:
StrawPoll strawPoll = new StrawPoll();
strawPoll. setTitle(“This is my poll”). addOptions(“Option 1”, “Option 2”). setIsMulti(false). setHasCaptcha(true). setDupCheck()
When adding options we have two different methods:
List options = Contains some options…
dOptions(“Option 1”, “Option 2”); //Add these to the current options already added.
dOptions(Array()); //Used for adding a List to the current options list
tOptions(options); //Replace the current list with a new list
Note that you do not need to set every field. You only need to set the required fields of a title and an option. Everything else will be set to a default value.
More Information
The StrawPoll API itself has a rate limit of creating 100 polls by any given user within 60 minute. To view more information visit the StrawPoll API Wiki
You can also view the raw JSON of any StrawPoll object. This could be one that you have updated/retrieved or one that you have just created. An example is shown below:
StrawPoll strawPoll = new StrawPoll(“);
String rawJSON = RawJSON();
JSON Returned:
{“id”:”1″, “title”:”What movie should we watch”, “options”:[“Sucker punch “, “Pirates of carribian “, “Prison logic”, “Witchhunter”], “multi”:false, “dupcheck”:”NORMAL”, “captcha”:false, “votes”:[25554, 51847, 10918, 12331]}
Built With
GSON – JSON Manipulation Library
Maven – Dependency Management
Contributing
If you feel like this API could be improved in any way, open an issue or make a pull request!
Authors
Samuel Maddock – Github Page
License
This project is licensed under the MIT License – see the file for details
StrawPoll.API 1.1.1 - NuGet

StrawPoll.API 1.1.1 – NuGet

README
Dependencies
Used By
Versions
Release Notes
StrawPollNET – Light, simple library for fetching and creating Strawpoll polls
How to use it?
Create API object
var strawpoll = new StrawPoll();
To fetch use tPollAsync(int id). Method returs an Poll object
var poll = tPollAsync(1);
Console. Writeline();
For creating a poll use eatePollAsync(string title, List options, bool multi, DupCheck dupcheck, bool capcha)
or use overloaded CreatePollAsync(PollRequest poll). Method returns a Poll object with Votes property filled with zeros.
Not filled variables will be replaced with default.
var poll = new PollRequest()
{
Title = “It is good? “,
Options = new List()
“Yes”,
“Nope”},
Dupcheck = DupCheck. DISABLED};
eatePoll(poll);
Em, Data clasess?
There is a 2 data classes:
Poll
public class Poll
public int Id { get; set;}
public string Title { get; set;}
public List Options { get; set;}
public List Votes { get; set;}
public bool Multi { get; set;}
public string Dupcheck { get; set;}
public bool Captcha { get; set;}
public string PollUrl { get;}}
PollRequest
public class PollRequest
public DupCheck? Dupcheck { get; set;}
public bool? Multi { get; set;}
public bool? Capcha { get; set;}}. NETStandard 1. 3
brary
(>= 1. 6. 1)
(>= 10. 0. 3). 6
(>= 10. NETStandard 2. 0
(>= 10. 3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version
Downloads
Last updated
1. 1. 1
664
10/4/2017
1. 0
552
1. 0
556
10/3/2017
v. 1 includes:
– Changed default captcha setting

Frequently Asked Questions about strawpoll api

About the author

proxyreview

If you 're a SEO / IM geek like us then you'll love our updates and our website. Follow us for the latest news in the world of web automation tools & proxy servers!

By proxyreview

Recent Posts

Useful Tools