Python library for Twingly Search API
A Python library for Twingly’s Search API (previously known as Analytics API). Twingly is a blog search service that provides a searchable API known as Twingly Search API.
Install via PyPI
pip install twingly-search
Or add twingly-search to your application’s requirements file and then run
pip install -r requirements.txt
Or from source code
git clone https://github.com/twingly/twingly-search-api-python.git cd twingly-search-api-python python setup.py install
from twingly_search import Client client = Client() q = 'github page-size: 10 lang:sv tspan:24h' result = client.execute_query(q) for post in result.posts: print post.url
Example code can be found in examples/.
The twingly_search library talks to a commercial blog search API and requires an API key. Best practice is to set the TWINGLY_SEARCH_KEY environment variable to the obtained key. twingly_search.Client can be passed a key at initialization if your setup does not allow environment variables.
To learn more about the capabilities of the API, please read the Twingly Search API documentation.
twingly_search is documented with pydoc. To read the documentation directly in your console you can run
or you can start a local pydoc web server with
pydoc -p 1234 twingly_search
In this case documentation will be available at http://localhost:1234/twingly_search.html
Install all dependencies
Run the tests
Make the release
To be able to publish the package, install twine and, optionally, python-dotenv:
pip install twine pip install python-dotenv[cli] # optional
If using python-dotenv or equivalent: set TWINE_USERNAME and TWINE_PASSWORD in .env, using the PyPI username and password.
You will need pandoc to convert README.md to reStructuredText:
brew install pandoc pip install pypandoc
Update the changelog
- Install GitHub Changelog
if you don’t have it
- gem install github_changelog_generator
- Set CHANGELOG_GITHUB_TOKEN to a personal access token to increase your GitHub API rate limit
- Generate the changelog
The MIT License (MIT)
Copyright (c) 2016 Twingly AB
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size twingly_search-2.1.3-py2-none-any.whl (11.2 kB)||File type Wheel||Python version py2||Upload date||Hashes View hashes|
|Filename, size twingly-search-2.1.3.tar.gz (9.4 kB)||File type Source||Python version None||Upload date||Hashes View hashes|
Hashes for twingly_search-2.1.3-py2-none-any.whl