Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Search answers on stackoverflow

Project Description

Search answers on Stack Overflow. Can use Google, Bing or DuckDuckGo search engine.

About

Just pass some keywords to the script and it will uses a search engine to find the most relevant pages on Stack Overflow.

Then, it will get the first code snippet from the question page or the full answer text.

Simple example:

$ askstack python delete dict key
---------------------------------------------------------------------------

Question: How to remove a key from a python dictionary?

my_dict.pop('key', None)


Answer from: https://stackoverflow.com/questions/11277432

---------------------------------------------------------------------------

Question: Delete an item from a dictionary

del d[key]


Answer from: https://stackoverflow.com/questions/5844672

---------------------------------------------------------------------------

Install

Install using pip:

pip install askstack

Usage

Usage: askstack keywords... [options]

search answers on stackoverflow

Options:
--version       show program's version number and exit
-h, --help      show this help message and exit
-a ANSWERS      number of answers to retrieve (default: 2)
-e ENGINE       search engine to use: 'google', 'bing', 'duckduckgo' or
                'fallback' - fallback will try google and fallback to bing
                and duckduckgo if a search fails (default: fallback)
-f, --fulltext  get the full answer text (default: disabled)
-s SLEEP        sleep time between requests (default: 0.5)
-t TIMEOUT      timeout in seconds to wait for reply (default: 5)

Examples

If you are feeling lucky, get only the first code snippet:

$ askstack linux gzip directory -a 1

Get full first answer:

$ askstack linux gzip directory -a 1 -f

Try to get three answers using only DuckDuckGo as the search engine:

$ askstack linux gzip directory -a 3 -e duckduckgo

Notes

  • Works on Python 2.7
  • Tested on Linux and Windows, but should work on all platforms
Release History

Release History

This version
History Node

0.1.2

History Node

0.1.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
askstack-0.1.2.tar.gz (5.0 kB) Copy SHA256 Checksum SHA256 Source Dec 24, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting