Skip to main content

askstack

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

Metadata

Release files for askstack 0.1.1

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

Source distribution (sdist)

Source distribution for askstack 0.1.1
File Size Uploaded Provenance Actions
askstack-0.1.1.tar.gz 5.0 kB Without provenance Details for askstack-0.1.1.tar.gz

Release files / askstack-0.1.1.tar.gz

Download URL askstack-0.1.1.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8529c59ddb98f8ac9505a503592ae4ecd91296fb5dd9d24d2d61828d616e777e
BLAKE2b-256 checksum
How to use checksums
8562448d490db968b9d2aa7251c2709bdb6c9e0137afa64c03ba1813d8e97241
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for askstack 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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