# eric7.WebBrowser.OpenSearch.OpenSearchEngine

Module implementing the open search engine.

### Global Attributes

None

### Classes

OpenSearchEngine | Class implementing the open search engine.

### Functions

None

## OpenSearchEngine

Class implementing the open search engine.

### Signals

imageChanged()
  emitted after the icon has been changed
suggestions(list of strings)
  emitted after the suggestions have been received

### Derived from

QObject

### Class Attributes

None

### Class Methods

parseTemplate | Class method to parse a search template.

### Methods

OpenSearchEngine | Constructor
__eq__ | Special method implementing the == operator.
__imageObtained | Private slot to receive the image of the engine.
__lt__ | Special method implementing the < operator.
__suggestionsObtained | Private slot to receive the suggestions.
description | Public method to get the description of the engine.
image | Public method to get the image of the engine.
imageUrl | Public method to get the image URL of the engine.
isValid | Public method to check, if the engine is valid.
loadImage | Public method to load the image of the engine.
name | Public method to get the name of the engine.
networkAccessManager | Public method to get a reference to the network access manager object.
providesSuggestions | Public method to check, if the engine provides suggestions.
requestSuggestions | Public method to request suggestions.
searchMethod | Public method to get the HTTP request method used to perform search requests.
searchParameters | Public method to get the search parameters of the engine.
searchUrl | Public method to get a URL ready for searching.
searchUrlTemplate | Public method to get the search URL template of the engine.
setDescription | Public method to set the engine description.
setImage | Public method to set the image of the engine.
setImageUrl | Public method to set the engine image URL.
setImageUrlAndLoad | Public method to set the engine image URL.
setName | Public method to set the engine name.
setNetworkAccessManager | Public method to set the reference to the network access manager.
setSearchMethod | Public method to set the HTTP request method used to perform search requests.
setSearchParameters | Public method to set the engine search parameters.
setSearchUrlTemplate | Public method to set the engine search URL template.
setSuggestionsMethod | Public method to set the HTTP request method used to perform suggestions requests.
setSuggestionsParameters | Public method to set the engine suggestions parameters.
setSuggestionsUrlTemplate | Public method to set the engine suggestions URL template.
suggestionsMethod | Public method to get the HTTP request method used to perform suggestions requests.
suggestionsParameters | Public method to get the suggestions parameters of the engine.
suggestionsUrl | Public method to get a URL ready for suggestions.
suggestionsUrlTemplate | Public method to get the search URL template of the engine.

### Static Methods

None

#### OpenSearchEngine.parseTemplate (class method)

parseTemplate(searchTerm, searchTemplate)

Class method to parse a search template.

searchTerm
  term to search for (string)
searchTemplate
  template to be parsed (string)

Return:
  parsed template (string)

#### OpenSearchEngine (Constructor)

OpenSearchEngine(parent=None)

Constructor

parent
  reference to the parent object (QObject)

#### OpenSearchEngine.__eq__

__eq__(other)

Special method implementing the == operator.

other
  reference to an open search engine (OpenSearchEngine)

Return:
  flag indicating equality (boolean)

#### OpenSearchEngine.__imageObtained

__imageObtained(reply)

Private slot to receive the image of the engine.

reply (QNetworkReply)
  reference to the network reply

#### OpenSearchEngine.__lt__

__lt__(other)

Special method implementing the < operator.

other
  reference to an open search engine (OpenSearchEngine)

Return:
  flag indicating less than (boolean)

#### OpenSearchEngine.__suggestionsObtained

__suggestionsObtained()

Private slot to receive the suggestions.

#### OpenSearchEngine.description

description()

Public method to get the description of the engine.

Return:
  description of the engine (string)

#### OpenSearchEngine.image

image()

Public method to get the image of the engine.

Return:
  image of the engine (QImage)

#### OpenSearchEngine.imageUrl

imageUrl()

Public method to get the image URL of the engine.

Return:
  image URL of the engine (string)

#### OpenSearchEngine.isValid

isValid()

Public method to check, if the engine is valid.

Return:
  flag indicating validity (boolean)

#### OpenSearchEngine.loadImage

loadImage()

Public method to load the image of the engine.

#### OpenSearchEngine.name

name()

Public method to get the name of the engine.

Return:
  name of the engine (string)

#### OpenSearchEngine.networkAccessManager

networkAccessManager()

Public method to get a reference to the network access manager object.

Return:
  reference to the network access manager object (QNetworkAccessManager)

#### OpenSearchEngine.providesSuggestions

providesSuggestions()

Public method to check, if the engine provides suggestions.

Return:
  flag indicating suggestions are provided (boolean)

#### OpenSearchEngine.requestSuggestions

requestSuggestions(searchTerm)

Public method to request suggestions.

searchTerm
  term to get suggestions for (string)

#### OpenSearchEngine.searchMethod

searchMethod()

Public method to get the HTTP request method used to perform search requests.

Return:
  HTTP request method (string)

#### OpenSearchEngine.searchParameters

searchParameters()

Public method to get the search parameters of the engine.

Return:
  search parameters of the engine (list of two tuples)

#### OpenSearchEngine.searchUrl

searchUrl(searchTerm)

Public method to get a URL ready for searching.

searchTerm
  term to search for (string)

Return:
  URL (QUrl)

#### OpenSearchEngine.searchUrlTemplate

searchUrlTemplate()

Public method to get the search URL template of the engine.

Return:
  search URL template of the engine (string)

#### OpenSearchEngine.setDescription

setDescription(description)

Public method to set the engine description.

description
  description of the engine (string)

#### OpenSearchEngine.setImage

setImage(image)

Public method to set the image of the engine.

image
  image to be set (QImage)

#### OpenSearchEngine.setImageUrl

setImageUrl(imageUrl)

Public method to set the engine image URL.

imageUrl
  image URL of the engine (string)

#### OpenSearchEngine.setImageUrlAndLoad

setImageUrlAndLoad(imageUrl)

Public method to set the engine image URL.

imageUrl
  image URL of the engine (string)

#### OpenSearchEngine.setName

setName(name)

Public method to set the engine name.

name
  name of the engine (string)

#### OpenSearchEngine.setNetworkAccessManager

setNetworkAccessManager(networkAccessManager)

Public method to set the reference to the network access manager.

networkAccessManager
  reference to the network access manager object (QNetworkAccessManager)

#### OpenSearchEngine.setSearchMethod

setSearchMethod(method)

Public method to set the HTTP request method used to perform search requests.

method
  HTTP request method (string)

#### OpenSearchEngine.setSearchParameters

setSearchParameters(searchParameters)

Public method to set the engine search parameters.

searchParameters
  search parameters of the engine (list of two tuples)

#### OpenSearchEngine.setSearchUrlTemplate

setSearchUrlTemplate(searchUrlTemplate)

Public method to set the engine search URL template.

The URL template is processed according to the specification: http://www.opensearch.org/Specifications/OpenSearch/1.1#OpenSearch_URL_template_syntax

A list of template parameters currently supported and what they are replaced with:

Parameter | Value
{count} | 20
{startIndex} | 0
{startPage} | 0
{language} | the default language code (RFC 3066)
{country} | the default country code (first part of language)
{inputEncoding} | UTF-8
{outputEncoding} | UTF-8
{searchTerms} | the string supplied by the user
{*:source} | application name, QCoreApplication::applicationName()

searchUrlTemplate
  search URL template of the engine (string)

#### OpenSearchEngine.setSuggestionsMethod

setSuggestionsMethod(method)

Public method to set the HTTP request method used to perform suggestions requests.

method
  HTTP request method (string)

#### OpenSearchEngine.setSuggestionsParameters

setSuggestionsParameters(suggestionsParameters)

Public method to set the engine suggestions parameters.

suggestionsParameters
  suggestions parameters of the engine (list of two tuples)

#### OpenSearchEngine.setSuggestionsUrlTemplate

setSuggestionsUrlTemplate(suggestionsUrlTemplate)

Public method to set the engine suggestions URL template.

suggestionsUrlTemplate
  suggestions URL template of the engine (string)

#### OpenSearchEngine.suggestionsMethod

suggestionsMethod()

Public method to get the HTTP request method used to perform suggestions requests.

Return:
  HTTP request method (string)

#### OpenSearchEngine.suggestionsParameters

suggestionsParameters()

Public method to get the suggestions parameters of the engine.

Return:
  suggestions parameters of the engine (list of two tuples)

#### OpenSearchEngine.suggestionsUrl

suggestionsUrl(searchTerm)

Public method to get a URL ready for suggestions.

searchTerm
  term to search for (string)

Return:
  URL (QUrl)

#### OpenSearchEngine.suggestionsUrlTemplate

suggestionsUrlTemplate()

Public method to get the search URL template of the engine.

Return:
  search URL template of the engine (string)

Up