# eric7.Plugins.UiExtensionPlugins.Translator.TranslatorRequest

Module implementing a synchronous network request handler for translation requests.

### Global Attributes

None

### Classes

TranslatorRequest | Class implementing a synchronous network request handler for translation requests.

### Functions

None

## TranslatorRequest

Class implementing a synchronous network request handler for translation requests.

### Derived from

QObject

### Class Attributes

None

### Class Methods

None

### Methods

TranslatorRequest | Constructor
get | Public method to issue a GET request.
post | Public method to issue a POST request.

### Static Methods

None

#### TranslatorRequest (Constructor)

TranslatorRequest(parent=None)

Constructor

parent (QObject)
  reference to the parent object

#### TranslatorRequest.get

get(requestUrl, extraHeaders=None)

Public method to issue a GET request.

requestUrl (QUrl)
  URL of the request
extraHeaders (tuple of (bytes, bytes))
  list of tuples of additional headers giving header name and header value

Return:
  server response or an error message and a success flag

Return Type:
  tuple of (QByteArray or str, bool)

#### TranslatorRequest.post

post(requestUrl, requestData, dataType="form", extraHeaders=None)

Public method to issue a POST request.

requestUrl (QUrl)
  URL of the request
requestData (QByteArray)
  data of the request
dataType (str)
  type of the request data
extraHeaders (list of tuple of (bytes, bytes))
  list of tuples of additional headers giving header name and header value

Return:
  tuple of server response (string) and flag indicating success (boolean)

Return Type:
  tuple of (str, bool)

Up