API

SpinnerChief

class spinnerchief.SpinnerChief(apikey, username, password)[source]

A class representing the Spinner Chief API (http://developer.spinnerchief.com/API_Document.aspx).

Articles must be in Unicode object type.

URL = u'http://api.spinnerchief.com:9001/apikey={apikey}&username={username}&password={password}&'

URL for invoking the API

_get_param_value(param_name, params)[source]

Returns parameter value or use default.

_send_request(text='', params={'pos': '0', 'usehurricane': '1', 'spinhtml': '0', 'protecthtml': '0', 'percent': '0', 'phrasecount': '2', 'Chartype': '1', 'replacetype': '0', 'autospin': '1', 'thesaurus': 'English', 'convertbase': '0', 'Orderly': '0', 'Wordscount': '5', 'spinfreq': '4', 'tagprotect': '[]', 'spintype': '0', 'UseGrammarAI': '0', 'protectwords': None, 'rule': 'none', 'onecharforword': '0', 'wordquality': '0', 'original': '0'})[source]

Invoke Spinner Chief API with given parameters and return its response.

Parameters:params (dictionary) – parameters to pass along with the request
Returns:API’s response (article)
Return type:string
_validate(params)[source]

Checks every single parameter and raise error on wrong key or value.

_value_has(param, values, params)[source]

Raise WrongParameterVal if value of param is not in values.

_value_is_int(param, params)[source]

Raise WrongParameterVal if value of param is not integer.

quota_left()[source]

The server returns today’s remaining query times of this account.

quota_used()[source]

The server returns today’s used query times of this account.

text_with_spintax(text, params=None)[source]

Return processed spun text with spintax.

Parameters:
  • text (string) – original text that needs to be changed
  • params (dictionary) – parameters to pass along with the request
Returns:

processed text in spintax format

Return type:

string

unique_variation(text, params=None)[source]

Return a unique variation of the given text.

Parameters:
  • text (string) – original text that needs to be changed
  • params (dictionary) – parameters to pass along with the request
Returns:

processed text

Return type:

string

Exceptions

exception spinnerchief.exceptions.LoginError(api_error_msg)[source]

Raised if there are login errors.

exception spinnerchief.exceptions.NetworkError(msg)[source]

Raised if there are network problems, like timeout.

exception spinnerchief.exceptions.SpinnerChiefError(api_error_msg)[source]

Base class for exceptions in Spinner Chief module.

exception spinnerchief.exceptions.WrongParameterName(name)[source]

Raised on unsuppported parameter name.

exception spinnerchief.exceptions.WrongParameterVal(name, val)[source]

Raised on invalid parameter value.