Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mesonium
gajim
Commits
33b9bf03
Commit
33b9bf03
authored
2 years ago
by
Daniel Brötzmann
Browse files
Options
Downloads
Patches
Plain Diff
chore: HTTPAuth: Add type annotations
parent
358180cf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gajim/common/modules/http_auth.py
+19
-3
19 additions, 3 deletions
gajim/common/modules/http_auth.py
with
19 additions
and
3 deletions
gajim/common/modules/http_auth.py
+
19
−
3
View file @
33b9bf03
...
...
@@ -14,17 +14,26 @@
# XEP-0070: Verifying HTTP Requests via XMPP
from
__future__
import
annotations
from
typing
import
Union
import
nbxmpp
from
nbxmpp.protocol
import
Iq
from
nbxmpp.protocol
import
Message
from
nbxmpp.structs
import
IqProperties
from
nbxmpp.structs
import
MessageProperties
from
nbxmpp.structs
import
StanzaHandler
from
nbxmpp.namespaces
import
Namespace
from
gajim.common
import
app
from
gajim.common
import
types
from
gajim.common.events
import
HttpAuth
from
gajim.common.modules.base
import
BaseModule
class
HTTPAuth
(
BaseModule
):
def
__init__
(
self
,
con
)
:
def
__init__
(
self
,
con
:
types
.
Client
)
->
None
:
BaseModule
.
__init__
(
self
,
con
)
self
.
handlers
=
[
...
...
@@ -39,7 +48,11 @@ def __init__(self, con):
priority
=
45
)
]
def
_http_auth
(
self
,
_con
,
stanza
,
properties
):
def
_http_auth
(
self
,
_con
:
types
.
xmppClient
,
stanza
:
Union
[
Iq
,
Message
],
properties
:
Union
[
IqProperties
,
MessageProperties
]
)
->
None
:
if
not
properties
.
is_http_auth
:
return
...
...
@@ -56,7 +69,10 @@ def _http_auth(self, _con, stanza, properties):
stanza
=
stanza
))
raise
nbxmpp
.
NodeProcessed
def
build_http_auth_answer
(
self
,
stanza
,
answer
):
def
build_http_auth_answer
(
self
,
stanza
:
Union
[
Iq
,
Message
],
answer
:
str
)
->
None
:
if
answer
==
'
yes
'
:
self
.
_log
.
info
(
'
Auth request approved
'
)
confirm
=
stanza
.
getTag
(
'
confirm
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment