pylint fixes

This commit is contained in:
Hugh Rundle 2023-04-13 20:21:35 +10:00
parent c7adb62831
commit 56a062d01f
3 changed files with 4 additions and 4 deletions

View file

@ -540,7 +540,7 @@ async def sign_and_send(
digest = make_digest(data)
signature = make_signature(
"post", sender, destination, now, digest, kwargs.get("use_legacy_key")
"post", sender, destination, now, digest=digest, use_legacy_key=kwargs.get("use_legacy_key")
)
headers = {

View file

@ -23,7 +23,7 @@ def create_key_pair():
def make_signature(
method, sender, destination, date, digest=None, use_legacy_key=False
method, sender, destination, date, **kwargs
):
"""uses a private key to sign an outgoing message"""
inbox_parts = urlparse(destination)
@ -33,6 +33,7 @@ def make_signature(
f"date: {date}",
]
headers = "(request-target) host date"
digest = kwargs.get("digest")
if digest is not None:
signature_headers.append(f"digest: {digest}")
headers = "(request-target) host date digest"
@ -43,7 +44,7 @@ def make_signature(
# For legacy reasons we need to use an incorrect keyId for older Bookwyrm versions
key_id = (
f"{sender.remote_id}#main-key"
if use_legacy_key
if kwargs.get("use_legacy_key")
else f"{sender.remote_id}/#main-key"
)
signature = {

View file

@ -3,7 +3,6 @@ import json
import re
import logging
from urllib.parse import urldefrag
import requests
from django.http import HttpResponse, Http404