Skip to main content

Build Status

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.

Installation

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

Usage

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.

Documentation

twingly_search is documented with pydoc. To read the documentation directly in your console you can run

pydoc twingly_search

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

Requirements

Development

Tests

Install all dependencies

make localdeps

Run the tests

make test

Release

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
  1. Bump the version in setup.py and __init__.py.

  2. Create a tag with the same version and push it to GitHub:

    git tag <VERSION> && git push --follow-tags
  3. Publish to PyPi, assuming usage of python-dotenv:

    dotenv run ./publish-to-pypi.sh

Update the changelog

  • Install GitHub Changelog Generator 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

    • github_changelog_generator

License

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.

Metadata

Release files for twingly-search 2.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for twingly-search 2.1.4
File Size Uploaded
twingly-search-2.1.4.tar.gz 12.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for twingly-search 2.1.4
File Interpreter ABI Platform
twingly_search-2.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 23.7 kB

Release files / twingly-search-2.1.4.tar.gz

Download URL twingly-search-2.1.4.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
85db76037686ab1319ecd680dd03f3e97851eae077fd5cc228400de0c3e26c5b
BLAKE2b-256 checksum
How to use checksums
79dc3047cef7dfca7be228021dd1b9270185914a779f14a689c19e3bd9b3aecb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release files / twingly_search-2.1.4-py3-none-any.whl

Download URL twingly_search-2.1.4-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1103ff16c218b0104fc8ed2318ffbbd2a75b0ffc32c0966653ec61c2526b3be6
BLAKE2b-256 checksum
How to use checksums
d999c0b6bde01db93d89b5e74fcdcfc93602fdf3576562775fd6e6f1cf9caea7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release history Release notifications | RSS feed

This release

2.1.4 This release

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page