Search learning-python.com

Search this site:
Search for this:
Search provider:

How This Page Works

When you press this page's Search button, it triggers a Python script on the server, which in turn builds a term site:site site-specific search query and passes it to a selected search provider using an HTTP redirect. You can view and fetch the code of the first two hops in this interaction with the links in the following:

This page  ⇒  Python script  ⇒  Provider

The net effect displays results in the provider's search-results page. The script in the middle uses basic CGI, and its redirect is a simple technique that leverages work already performed by search providers that have crawled the site (invited or not).

Assorted usage tips:

To learn more about the redirect techniques used here, see this, this, and this. To explore other ways to add search to sites, try here and here, though many require JavaScript on the client or PHP on the server, and come with some of the blacker tradeoffs described in the next section.

Search-Provider Cautions

Because this page delegates searches to third parties, it sports some inherent caveats:

Online sites only
This page's scheme naturally works only for sites available on the general Internet, because it relies on search-provider crawls. Most off-line and intranet sites won't qualify.
Provider quirks
Some search providers support this page's scheme better than others. As of 2020, for instance, exiting Bing results may require multiple Backs (this seems to happen randomly and exclusively in desktop Firefox); Yandex may ask you to verify the automated search (with an occasional challenge reply); and Google and StartPage seem best at search terms with emojis (Baidu and Yandex often work too).
Darker themes
Most grievously, search providers may track searchers, and taint result pages with advertising, unrelated photos, or both. This also varies by provider (and changes over time), but the effects can range from blatantly rude to outright silly. In earlier testing, Google's search results for "fortran" at this site listed paid ads for Fortran compilers first, and Bing displayed pictures of pastry chefs for "decorators" (yes, really).

Some caveats can be lessened by user choices. Tracking, for example, can be addressed by using privacy-respecting sites, which are strongly recommended for users of this page. Among these, DuckDuckGo seems the furthest along, StartPage seems a close runner-up, and Privado and OneSearch are promising newcomers. Although other search providers can be selected above for comparison, their tracking focus makes them innately perilous, and a use-at-your-own-risk proposition.

Regardless of their tracking policies, some search providers still piggyback on others (your results may come from Google or Bing, even if you're searching elsewhere), and most—if not all—will still sometimes show you sponsored links or ads. There is no known silver bullet for all the annoying ads, unfortunately, but non-tracking providers at least won't treat you like a resource to be covertly exploited.

There's more on this story in this site's full privacy policy here. Search would ideally avoid third parties altogether, of course, but a more custom solution is currently outside this site's proprietor's schedule. For more on web-search privacy options, see this; or try a web search...



[Home page] Books Code Blog Python Author Train Find ©M.Lutz