pass Actor to Inbox
This commit is contained in:
parent
676bb53f43
commit
7c6f5c51d3
1 changed files with 4 additions and 3 deletions
|
@ -13,7 +13,7 @@ class Actor(object):
|
|||
def load(self):
|
||||
data = ap_utils.activity_request(self.url)
|
||||
self.username = data["preferredUsername"]
|
||||
self.inbox = Inbox(data["inbox"])
|
||||
self.inbox = Inbox(self, data["inbox"])
|
||||
self.outbox = Outbox(data["outbox"])
|
||||
|
||||
class Outbox(object):
|
||||
|
@ -37,7 +37,8 @@ class Outbox(object):
|
|||
return items
|
||||
|
||||
class Inbox(object):
|
||||
def __init__(self, url):
|
||||
def __init__(self, actor, url):
|
||||
self.actor = actor
|
||||
self._url = url
|
||||
def send(self, activity, private_key):
|
||||
now = email.utils.formatdate(timeval=None, localtime=False, usegmt=True)
|
||||
|
@ -50,6 +51,6 @@ class Inbox(object):
|
|||
sign_headers.insert(0, ["(request-target)", "post %s" % parts.path])
|
||||
signature = ap_security.signature(private_key, sign_headers)
|
||||
|
||||
return ap_utils.activity_request(self._url, activity.format(self),
|
||||
return ap_utils.activity_request(self._url, activity.format(self.actor),
|
||||
method="POST")
|
||||
|
||||
|
|
Loading…
Reference in a new issue