PySide6.QtNetworkAuth.QOAuth1Signature¶
- class QOAuth1Signature¶
- Implements OAuth 1 signature methods. More… - Synopsis¶- Methods¶- def - __init__()
- def - addRequestBody()
- def - hmacSha1()
- def - insert()
- def - keys()
- def - parameters()
- def - plainText()
- def - rsaSha1()
- def - setParameters()
- def - setTokenSecret()
- def - setUrl()
- def - swap()
- def - take()
- def - tokenSecret()
- def - url()
- def - value()
 - Static functions¶- def - plainText()
 - Note - This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE - Detailed Description¶- OAuth-authenticated requests can have two sets of credentials: those passed via the “oauth_consumer_key” parameter and those in the “oauth_token” parameter. In order for the server to verify the authenticity of the request and prevent unauthorized access, the client needs to prove that it is the rightful owner of the credentials. This is accomplished using the shared-secret (or RSA key) part of each set of credentials. - OAuth specifies three methods for the client to establish its rightful ownership of the credentials: “HMAC-SHA1”, “RSA-SHA1”, and “PLAINTEXT”. Each generates a “signature” with which the request is “signed”; the first two use a digest of the data signed in generating this, though the last does not. The “RSA-SHA1” method is not supported here; it would use an RSA key rather than the shared-secret associated with the client credentials. - class HttpRequestMethod¶
- Indicates the HTTP request method. - Constant - Description - QOAuth1Signature.HttpRequestMethod.Head - HEAD method. - QOAuth1Signature.HttpRequestMethod.Get - GET method. - QOAuth1Signature.HttpRequestMethod.Put - PUT method. - QOAuth1Signature.HttpRequestMethod.Post - POST method. - QOAuth1Signature.HttpRequestMethod.Delete - DELETE method. - QOAuth1Signature.HttpRequestMethod.Custom - Identifies a custom method. - QOAuth1Signature.HttpRequestMethod.Unknown - Method not set. 
 - __init__(other)¶
- Parameters:
- other – - QOAuth1Signature
 
 - Creates a copy of - other.- __init__([url=QUrl()[, method=QOAuth1Signature.HttpRequestMethod.Post[, parameters={}]]])
- Parameters:
- url – - QUrl
- method – - HttpRequestMethod
- parameters – .QMultiMapQString,QVariant 
 
 
 - Creates a - QOAuth1Signatureusing- urlas the target address
- methodas the HTTP method used to send the request
- and the given user - parametersto augment the request.
 - __init__(url, clientSharedKey, tokenSecret[, method=QOAuth1Signature.HttpRequestMethod.Post[, parameters={}]])
- Parameters:
- url – - QUrl
- clientSharedKey – str 
- tokenSecret – str 
- method – - HttpRequestMethod
- parameters – .QMultiMapQString,QVariant 
 
 
 - Creates a - QOAuth1Signatureusing- urlas the target address
- clientSharedKeyas the user token used to verify the signature
- tokenSecretas the negotiated token used to verify the signature
- methodas the HTTP method used to send the request
- and the given user - parametersto augment the request.
 - Adds the request - bodyto the signature. When a POST request body contains arguments they should be included in the signed data.- Return type:
- str 
 
 - Returns the user secret used to generate the signature. - See also - customMethodString()¶
- Return type:
 
 - Returns the custom method string. - hmacSha1()¶
- Return type:
 
 - Generates the HMAC-SHA1 signature using the client shared secret and, where available, token secret. - httpRequestMethod()¶
- Return type:
 
 - Returns the request method. - See also - insert(key, value)¶
- Parameters:
- key – str 
- value – object 
 
 
 - Inserts a new pair - key,- valueinto the signature. When a POST request body contains arguments they should be included in the signed data.- keys()¶
- Return type:
- .list of QString 
 
 - Retrieves the list of keys of parameters included in the signed data. - parameters()¶
- Return type:
- .QMultiMapQString,QVariant 
 
 - Returns the parameters. - See also - plainText()¶
- Return type:
 
 - Generates the PLAINTEXT signature. - static plainText(clientSharedSecret, tokenSecret)
- Parameters:
- clientSharedSecret – str 
- tokenSecret – str 
 
- Return type:
 
 - Generates a PLAINTEXT signature from the client secret - clientSharedKeyand the token secret- tokenSecret.- rsaSha1()¶
- Return type:
 
 - Generates the RSA-SHA1 signature. - Note - Currently this method is not supported. - Parameters:
- secret – str 
 
 - Sets - secretas the user secret used to generate the signature.- See also - setCustomMethodString(verb)¶
- Parameters:
- verb – - QByteArray
 
 - Sets a custom request method. Will set the - httpRequestMethodto- Customand store the- verbto use it for the generation of the signature.- Note - Using this method is required when working with custom verbs. Setting only the request method will fail, as the signure needs to know the actual verb. - setHttpRequestMethod(method)¶
- Parameters:
- method – - HttpRequestMethod
 
 - Sets the request - method.- See also - setParameters(parameters)¶
- Parameters:
- parameters – .QMultiMapQString,QVariant 
 
 - Sets the - parameters.- See also - setTokenSecret(secret)¶
- Parameters:
- secret – str 
 
 - Sets - secretas the negotiated secret used to generate the signature.- See also - Sets the URL to - url.- See also - swap(other)¶
- Parameters:
- other – - QOAuth1Signature
 
 - Swaps signature - otherwith this signature. This operation is very fast and never fails.- take(key)¶
- Parameters:
- key – str 
- Return type:
- object 
 
 - Removes - keyand any associated value from the signed data.- tokenSecret()¶
- Return type:
- str 
 
 - Returns the negotiated secret used to generate the signature. - See also - Returns the URL. - See also - value(key[, defaultValue=None])¶
- Parameters:
- key – str 
- defaultValue – object 
 
- Return type:
- object 
 
 - Returns the value associated with - key, if present in the signed data, otherwise- defaultValue.