QtNetworkAuth.pyi 16.9 KB
Newer Older
xuebingbing's avatar
xuebingbing committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307
# The PEP 484 type hints stub file for the QtNetworkAuth module.
#
# Generated by SIP 4.19.13
#
# Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
# 
# This file is part of PyQt5.
# 
# This file may be used under the terms of the GNU General Public License
# version 3.0 as published by the Free Software Foundation and appearing in
# the file LICENSE included in the packaging of this file.  Please review the
# following information to ensure the GNU General Public License version 3.0
# requirements will be met: http://www.gnu.org/copyleft/gpl.html.
# 
# If you do not wish to use this file under the terms of the GPL version 3.0
# then you may purchase a commercial license.  For more information contact
# info@riverbankcomputing.com.
# 
# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.


import typing
import sip

from PyQt5 import QtNetwork
from PyQt5 import QtCore

# Support for QDate, QDateTime and QTime.
import datetime

# Convenient type aliases.
PYQT_SIGNAL = typing.Union[QtCore.pyqtSignal, QtCore.pyqtBoundSignal]
PYQT_SLOT = typing.Union[typing.Callable[..., None], QtCore.pyqtBoundSignal]


class QAbstractOAuth(QtCore.QObject):

    class ContentType(int): ...
    WwwFormUrlEncoded = ... # type: 'QAbstractOAuth.ContentType'
    Json = ... # type: 'QAbstractOAuth.ContentType'

    class Error(int): ...
    NoError = ... # type: 'QAbstractOAuth.Error'
    NetworkError = ... # type: 'QAbstractOAuth.Error'
    ServerError = ... # type: 'QAbstractOAuth.Error'
    OAuthTokenNotFoundError = ... # type: 'QAbstractOAuth.Error'
    OAuthTokenSecretNotFoundError = ... # type: 'QAbstractOAuth.Error'
    OAuthCallbackNotVerified = ... # type: 'QAbstractOAuth.Error'

    class Stage(int): ...
    RequestingTemporaryCredentials = ... # type: 'QAbstractOAuth.Stage'
    RequestingAuthorization = ... # type: 'QAbstractOAuth.Stage'
    RequestingAccessToken = ... # type: 'QAbstractOAuth.Stage'
    RefreshingAccessToken = ... # type: 'QAbstractOAuth.Stage'

    class Status(int): ...
    NotAuthenticated = ... # type: 'QAbstractOAuth.Status'
    TemporaryCredentialsReceived = ... # type: 'QAbstractOAuth.Status'
    Granted = ... # type: 'QAbstractOAuth.Status'
    RefreshingToken = ... # type: 'QAbstractOAuth.Status'

    @staticmethod
    def generateRandomString(length: int) -> QtCore.QByteArray: ...
    def resourceOwnerAuthorization(self, url: QtCore.QUrl, parameters: typing.Dict[str, typing.Any]) -> None: ...
    def callback(self) -> str: ...
    def setStatus(self, status: 'QAbstractOAuth.Status') -> None: ...
    def replyDataReceived(self, data: typing.Union[QtCore.QByteArray, bytes, bytearray]) -> None: ...
    def finished(self, reply: QtNetwork.QNetworkReply) -> None: ...
    def granted(self) -> None: ...
    def authorizeWithBrowser(self, url: QtCore.QUrl) -> None: ...
    def requestFailed(self, error: 'QAbstractOAuth.Error') -> None: ...
    def contentTypeChanged(self, contentType: 'QAbstractOAuth.ContentType') -> None: ...
    def extraTokensChanged(self, tokens: typing.Dict[str, typing.Any]) -> None: ...
    def authorizationUrlChanged(self, url: QtCore.QUrl) -> None: ...
    def statusChanged(self, status: 'QAbstractOAuth.Status') -> None: ...
    def tokenChanged(self, token: str) -> None: ...
    def clientIdentifierChanged(self, clientIdentifier: str) -> None: ...
    def grant(self) -> None: ...
    def setContentType(self, contentType: 'QAbstractOAuth.ContentType') -> None: ...
    def contentType(self) -> 'QAbstractOAuth.ContentType': ...
    def setModifyParametersFunction(self, modifyParametersFunction: typing.Callable[..., None]) -> None: ...
    def modifyParametersFunction(self) -> typing.Callable[..., None]: ...
    def deleteResource(self, url: QtCore.QUrl, parameters: typing.Dict[str, typing.Any] = ...) -> QtNetwork.QNetworkReply: ...
    def put(self, url: QtCore.QUrl, parameters: typing.Dict[str, typing.Any] = ...) -> QtNetwork.QNetworkReply: ...
    def post(self, url: QtCore.QUrl, parameters: typing.Dict[str, typing.Any] = ...) -> QtNetwork.QNetworkReply: ...
    def get(self, url: QtCore.QUrl, parameters: typing.Dict[str, typing.Any] = ...) -> QtNetwork.QNetworkReply: ...
    def head(self, url: QtCore.QUrl, parameters: typing.Dict[str, typing.Any] = ...) -> QtNetwork.QNetworkReply: ...
    def setReplyHandler(self, handler: 'QAbstractOAuthReplyHandler') -> None: ...
    def replyHandler(self) -> 'QAbstractOAuthReplyHandler': ...
    def extraTokens(self) -> typing.Dict[str, typing.Any]: ...
    def setAuthorizationUrl(self, url: QtCore.QUrl) -> None: ...
    def authorizationUrl(self) -> QtCore.QUrl: ...
    def status(self) -> 'QAbstractOAuth.Status': ...
    def setNetworkAccessManager(self, networkAccessManager: QtNetwork.QNetworkAccessManager) -> None: ...
    def networkAccessManager(self) -> QtNetwork.QNetworkAccessManager: ...
    def setToken(self, token: str) -> None: ...
    def token(self) -> str: ...
    def setClientIdentifier(self, clientIdentifier: str) -> None: ...
    def clientIdentifier(self) -> str: ...


class QAbstractOAuth2(QAbstractOAuth):

    @typing.overload
    def __init__(self, parent: typing.Optional[QtCore.QObject] = ...) -> None: ...
    @typing.overload
    def __init__(self, manager: QtNetwork.QNetworkAccessManager, parent: typing.Optional[QtCore.QObject] = ...) -> None: ...

    def setResponseType(self, responseType: str) -> None: ...
    def authorizationCallbackReceived(self, data: typing.Dict[str, typing.Any]) -> None: ...
    def error(self, error: str, errorDescription: str, uri: QtCore.QUrl) -> None: ...
    def expirationAtChanged(self, expiration: typing.Union[QtCore.QDateTime, datetime.datetime]) -> None: ...
    def stateChanged(self, state: str) -> None: ...
    def clientIdentifierSharedKeyChanged(self, clientIdentifierSharedKey: str) -> None: ...
    def responseTypeChanged(self, responseType: str) -> None: ...
    def userAgentChanged(self, userAgent: str) -> None: ...
    def scopeChanged(self, scope: str) -> None: ...
    def setRefreshToken(self, refreshToken: str) -> None: ...
    def refreshToken(self) -> str: ...
    def expirationAt(self) -> QtCore.QDateTime: ...
    def setState(self, state: str) -> None: ...
    def state(self) -> str: ...
    def setClientIdentifierSharedKey(self, clientIdentifierSharedKey: str) -> None: ...
    def clientIdentifierSharedKey(self) -> str: ...
    def responseType(self) -> str: ...
    def setUserAgent(self, userAgent: str) -> None: ...
    def userAgent(self) -> str: ...
    def setScope(self, scope: str) -> None: ...
    def scope(self) -> str: ...
    def deleteResource(self, url: QtCore.QUrl, parameters: typing.Dict[str, typing.Any] = ...) -> QtNetwork.QNetworkReply: ...
    @typing.overload
    def put(self, url: QtCore.QUrl, parameters: typing.Dict[str, typing.Any] = ...) -> QtNetwork.QNetworkReply: ...
    @typing.overload
    def put(self, url: QtCore.QUrl, data: typing.Union[QtCore.QByteArray, bytes, bytearray]) -> QtNetwork.QNetworkReply: ...
    @typing.overload
    def put(self, url: QtCore.QUrl, multiPart: QtNetwork.QHttpMultiPart) -> QtNetwork.QNetworkReply: ...
    @typing.overload
    def post(self, url: QtCore.QUrl, parameters: typing.Dict[str, typing.Any] = ...) -> QtNetwork.QNetworkReply: ...
    @typing.overload
    def post(self, url: QtCore.QUrl, data: typing.Union[QtCore.QByteArray, bytes, bytearray]) -> QtNetwork.QNetworkReply: ...
    @typing.overload
    def post(self, url: QtCore.QUrl, multiPart: QtNetwork.QHttpMultiPart) -> QtNetwork.QNetworkReply: ...
    def get(self, url: QtCore.QUrl, parameters: typing.Dict[str, typing.Any] = ...) -> QtNetwork.QNetworkReply: ...
    def head(self, url: QtCore.QUrl, parameters: typing.Dict[str, typing.Any] = ...) -> QtNetwork.QNetworkReply: ...
    def createAuthenticatedUrl(self, url: QtCore.QUrl, parameters: typing.Dict[str, typing.Any] = ...) -> QtCore.QUrl: ...


class QAbstractOAuthReplyHandler(QtCore.QObject):

    def __init__(self, parent: typing.Optional[QtCore.QObject] = ...) -> None: ...

    def callbackDataReceived(self, data: typing.Union[QtCore.QByteArray, bytes, bytearray]) -> None: ...
    def replyDataReceived(self, data: typing.Union[QtCore.QByteArray, bytes, bytearray]) -> None: ...
    def tokensReceived(self, tokens: typing.Dict[str, typing.Any]) -> None: ...
    def callbackReceived(self, values: typing.Dict[str, typing.Any]) -> None: ...
    def networkReplyFinished(self, reply: QtNetwork.QNetworkReply) -> None: ...
    def callback(self) -> str: ...


class QOAuth1(QAbstractOAuth):

    class SignatureMethod(int): ...
    Hmac_Sha1 = ... # type: 'QOAuth1.SignatureMethod'
    Rsa_Sha1 = ... # type: 'QOAuth1.SignatureMethod'
    PlainText = ... # type: 'QOAuth1.SignatureMethod'

    @typing.overload
    def __init__(self, parent: typing.Optional[QtCore.QObject] = ...) -> None: ...
    @typing.overload
    def __init__(self, manager: QtNetwork.QNetworkAccessManager, parent: typing.Optional[QtCore.QObject] = ...) -> None: ...
    @typing.overload
    def __init__(self, clientIdentifier: str, clientSharedSecret: str, manager: QtNetwork.QNetworkAccessManager, parent: typing.Optional[QtCore.QObject] = ...) -> None: ...

    @staticmethod
    def generateAuthorizationHeader(oauthParams: typing.Dict[str, typing.Any]) -> QtCore.QByteArray: ...
    @staticmethod
    def nonce() -> QtCore.QByteArray: ...
    def setup(self, request: QtNetwork.QNetworkRequest, signingParameters: typing.Dict[str, typing.Any], operation: QtNetwork.QNetworkAccessManager.Operation) -> None: ...
    def requestTokenCredentials(self, operation: QtNetwork.QNetworkAccessManager.Operation, url: QtCore.QUrl, temporaryToken: typing.Tuple[str, str], parameters: typing.Dict[str, typing.Any] = ...) -> QtNetwork.QNetworkReply: ...
    def requestTemporaryCredentials(self, operation: QtNetwork.QNetworkAccessManager.Operation, url: QtCore.QUrl, parameters: typing.Dict[str, typing.Any] = ...) -> QtNetwork.QNetworkReply: ...
    def tokenCredentialsUrlChanged(self, url: QtCore.QUrl) -> None: ...
    def temporaryCredentialsUrlChanged(self, url: QtCore.QUrl) -> None: ...
    def tokenSecretChanged(self, token: str) -> None: ...
    def clientSharedSecretChanged(self, credential: str) -> None: ...
    def signatureMethodChanged(self, method: 'QOAuth1.SignatureMethod') -> None: ...
    def continueGrantWithVerifier(self, verifier: str) -> None: ...
    def grant(self) -> None: ...
    def deleteResource(self, url: QtCore.QUrl, parameters: typing.Dict[str, typing.Any] = ...) -> QtNetwork.QNetworkReply: ...
    def put(self, url: QtCore.QUrl, parameters: typing.Dict[str, typing.Any] = ...) -> QtNetwork.QNetworkReply: ...
    def post(self, url: QtCore.QUrl, parameters: typing.Dict[str, typing.Any] = ...) -> QtNetwork.QNetworkReply: ...
    def get(self, url: QtCore.QUrl, parameters: typing.Dict[str, typing.Any] = ...) -> QtNetwork.QNetworkReply: ...
    def head(self, url: QtCore.QUrl, parameters: typing.Dict[str, typing.Any] = ...) -> QtNetwork.QNetworkReply: ...
    def setSignatureMethod(self, value: 'QOAuth1.SignatureMethod') -> None: ...
    def signatureMethod(self) -> 'QOAuth1.SignatureMethod': ...
    def setTokenCredentialsUrl(self, url: QtCore.QUrl) -> None: ...
    def tokenCredentialsUrl(self) -> QtCore.QUrl: ...
    def setTemporaryCredentialsUrl(self, url: QtCore.QUrl) -> None: ...
    def temporaryCredentialsUrl(self) -> QtCore.QUrl: ...
    @typing.overload
    def setTokenCredentials(self, tokenCredentials: typing.Tuple[str, str]) -> None: ...
    @typing.overload
    def setTokenCredentials(self, token: str, tokenSecret: str) -> None: ...
    def tokenCredentials(self) -> typing.Tuple[str, str]: ...
    def setTokenSecret(self, tokenSecret: str) -> None: ...
    def tokenSecret(self) -> str: ...
    @typing.overload
    def setClientCredentials(self, clientCredentials: typing.Tuple[str, str]) -> None: ...
    @typing.overload
    def setClientCredentials(self, clientIdentifier: str, clientSharedSecret: str) -> None: ...
    def clientCredentials(self) -> typing.Tuple[str, str]: ...
    def setClientSharedSecret(self, clientSharedSecret: str) -> None: ...
    def clientSharedSecret(self) -> str: ...


class QOAuth1Signature(sip.simplewrapper):

    class HttpRequestMethod(int): ...
    Head = ... # type: 'QOAuth1Signature.HttpRequestMethod'
    Get = ... # type: 'QOAuth1Signature.HttpRequestMethod'
    Put = ... # type: 'QOAuth1Signature.HttpRequestMethod'
    Post = ... # type: 'QOAuth1Signature.HttpRequestMethod'
    Delete = ... # type: 'QOAuth1Signature.HttpRequestMethod'
    Custom = ... # type: 'QOAuth1Signature.HttpRequestMethod'
    Unknown = ... # type: 'QOAuth1Signature.HttpRequestMethod'

    @typing.overload
    def __init__(self, url: QtCore.QUrl = ..., method: 'QOAuth1Signature.HttpRequestMethod' = ..., parameters: typing.Dict[str, typing.Any] = ...) -> None: ...
    @typing.overload
    def __init__(self, url: QtCore.QUrl, clientSharedKey: str, tokenSecret: str, method: 'QOAuth1Signature.HttpRequestMethod' = ..., parameters: typing.Dict[str, typing.Any] = ...) -> None: ...
    @typing.overload
    def __init__(self, other: 'QOAuth1Signature') -> None: ...

    def swap(self, other: 'QOAuth1Signature') -> None: ...
    @typing.overload
    def plainText(self) -> QtCore.QByteArray: ...
    @typing.overload
    @staticmethod
    def plainText(clientSharedSecret: str, tokenSecret: str) -> QtCore.QByteArray: ...
    def rsaSha1(self) -> QtCore.QByteArray: ...
    def hmacSha1(self) -> QtCore.QByteArray: ...
    def setTokenSecret(self, secret: str) -> None: ...
    def tokenSecret(self) -> str: ...
    def setClientSharedKey(self, secret: str) -> None: ...
    def clientSharedKey(self) -> str: ...
    def value(self, key: str, defaultValue: typing.Any = ...) -> typing.Any: ...
    def take(self, key: str) -> typing.Any: ...
    def keys(self) -> typing.List[str]: ...
    def insert(self, key: str, value: typing.Any) -> None: ...
    def addRequestBody(self, body: QtCore.QUrlQuery) -> None: ...
    def setParameters(self, parameters: typing.Dict[str, typing.Any]) -> None: ...
    def parameters(self) -> typing.Dict[str, typing.Any]: ...
    def setUrl(self, url: QtCore.QUrl) -> None: ...
    def url(self) -> QtCore.QUrl: ...
    def setHttpRequestMethod(self, method: 'QOAuth1Signature.HttpRequestMethod') -> None: ...
    def httpRequestMethod(self) -> 'QOAuth1Signature.HttpRequestMethod': ...


class QOAuth2AuthorizationCodeFlow(QAbstractOAuth2):

    @typing.overload
    def __init__(self, parent: typing.Optional[QtCore.QObject] = ...) -> None: ...
    @typing.overload
    def __init__(self, manager: QtNetwork.QNetworkAccessManager, parent: typing.Optional[QtCore.QObject] = ...) -> None: ...
    @typing.overload
    def __init__(self, clientIdentifier: str, manager: QtNetwork.QNetworkAccessManager, parent: typing.Optional[QtCore.QObject] = ...) -> None: ...
    @typing.overload
    def __init__(self, authorizationUrl: QtCore.QUrl, accessTokenUrl: QtCore.QUrl, manager: QtNetwork.QNetworkAccessManager, parent: typing.Optional[QtCore.QObject] = ...) -> None: ...
    @typing.overload
    def __init__(self, clientIdentifier: str, authorizationUrl: QtCore.QUrl, accessTokenUrl: QtCore.QUrl, manager: QtNetwork.QNetworkAccessManager, parent: typing.Optional[QtCore.QObject] = ...) -> None: ...

    def resourceOwnerAuthorization(self, url: QtCore.QUrl, parameters: typing.Dict[str, typing.Any] = ...) -> None: ...
    def requestAccessToken(self, code: str) -> None: ...
    def buildAuthenticateUrl(self, parameters: typing.Dict[str, typing.Any] = ...) -> QtCore.QUrl: ...
    def accessTokenUrlChanged(self, accessTokenUrl: QtCore.QUrl) -> None: ...
    def refreshAccessToken(self) -> None: ...
    def grant(self) -> None: ...
    def setAccessTokenUrl(self, accessTokenUrl: QtCore.QUrl) -> None: ...
    def accessTokenUrl(self) -> QtCore.QUrl: ...


class QOAuthOobReplyHandler(QAbstractOAuthReplyHandler):

    def __init__(self, parent: typing.Optional[QtCore.QObject] = ...) -> None: ...

    def networkReplyFinished(self, reply: QtNetwork.QNetworkReply) -> None: ...
    def callback(self) -> str: ...


class QOAuthHttpServerReplyHandler(QOAuthOobReplyHandler):

    @typing.overload
    def __init__(self, parent: typing.Optional[QtCore.QObject] = ...) -> None: ...
    @typing.overload
    def __init__(self, port: int, parent: typing.Optional[QtCore.QObject] = ...) -> None: ...
    @typing.overload
    def __init__(self, address: typing.Union[QtNetwork.QHostAddress, QtNetwork.QHostAddress.SpecialAddress], port: int, parent: typing.Optional[QtCore.QObject] = ...) -> None: ...

    def isListening(self) -> bool: ...
    def close(self) -> None: ...
    def listen(self, address: typing.Union[QtNetwork.QHostAddress, QtNetwork.QHostAddress.SpecialAddress] = ..., port: int = ...) -> bool: ...
    def port(self) -> int: ...
    def setCallbackText(self, text: str) -> None: ...
    def callbackText(self) -> str: ...
    def setCallbackPath(self, path: str) -> None: ...
    def callbackPath(self) -> str: ...
    def callback(self) -> str: ...