# eric7.WebBrowser.UserAgent.UserAgentManager

Module implementing a user agent manager.

### Global Attributes

None

### Classes

UserAgentManager | Class implementing a user agent manager.

### Functions

None

## UserAgentManager

Class implementing a user agent manager.

### Signals

changed()
  emitted to indicate a change
userAgentSettingsSaved()
  emitted after the user agent settings were saved

### Derived from

QObject

### Class Attributes

None

### Class Methods

None

### Methods

UserAgentManager | Constructor
__load | Private method to load the saved user agent settings.
allHostNames | Public method to get a list of all host names we a user agent setting for.
close | Public method to close the user agents manager.
getFileName | Public method to get the file name of the user agents file.
hostsCount | Public method to get the number of available user agent settings.
reload | Public method to reload the user agent settings.
removeUserAgent | Public method to remove a user agent entry.
save | Public slot to save the user agent entries to disk.
setUserAgent | Public method to set the user agent string for a host.
setUserAgentForUrl | Public method to set the user agent string for an URL.
userAgent | Public method to get the user agent setting for a host.
userAgentForUrl | Public method to determine the user agent for the given URL.

### Static Methods

None

#### UserAgentManager (Constructor)

UserAgentManager(parent=None)

Constructor

parent (QObject)
  reference to the parent object

#### UserAgentManager.__load

__load()

Private method to load the saved user agent settings.

#### UserAgentManager.allHostNames

allHostNames()

Public method to get a list of all host names we a user agent setting for.

Return:
  sorted list of all host names

Return Type:
  list of str

#### UserAgentManager.close

close()

Public method to close the user agents manager.

#### UserAgentManager.getFileName

getFileName()

Public method to get the file name of the user agents file.

Return:
  name of the user agents file

Return Type:
  str

#### UserAgentManager.hostsCount

hostsCount()

Public method to get the number of available user agent settings.

Return:
  number of user agent settings

Return Type:
  int

#### UserAgentManager.reload

reload()

Public method to reload the user agent settings.

#### UserAgentManager.removeUserAgent

removeUserAgent(host)

Public method to remove a user agent entry.

host (str)
  host name

#### UserAgentManager.save

save()

Public slot to save the user agent entries to disk.

#### UserAgentManager.setUserAgent

setUserAgent(host, agent)

Public method to set the user agent string for a host.

host (str)
  host name
agent (str)
  user agent string

#### UserAgentManager.setUserAgentForUrl

setUserAgentForUrl(url, agent)

Public method to set the user agent string for an URL.

url (QUrl)
  URL to register user agent setting for
agent (str)
  new current user agent string

#### UserAgentManager.userAgent

userAgent(host)

Public method to get the user agent setting for a host.

host (str)
  host name

Return:
  user agent string

Return Type:
  str

#### UserAgentManager.userAgentForUrl

userAgentForUrl(url)

Public method to determine the user agent for the given URL.

url (QUrl)
  URL to determine user agent for

Return:
  user agent string

Return Type:
  str

Up