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):
|
def load(self):
|
||||||
data = ap_utils.activity_request(self.url)
|
data = ap_utils.activity_request(self.url)
|
||||||
self.username = data["preferredUsername"]
|
self.username = data["preferredUsername"]
|
||||||
self.inbox = Inbox(data["inbox"])
|
self.inbox = Inbox(self, data["inbox"])
|
||||||
self.outbox = Outbox(data["outbox"])
|
self.outbox = Outbox(data["outbox"])
|
||||||
|
|
||||||
class Outbox(object):
|
class Outbox(object):
|
||||||
|
@ -37,7 +37,8 @@ class Outbox(object):
|
||||||
return items
|
return items
|
||||||
|
|
||||||
class Inbox(object):
|
class Inbox(object):
|
||||||
def __init__(self, url):
|
def __init__(self, actor, url):
|
||||||
|
self.actor = actor
|
||||||
self._url = url
|
self._url = url
|
||||||
def send(self, activity, private_key):
|
def send(self, activity, private_key):
|
||||||
now = email.utils.formatdate(timeval=None, localtime=False, usegmt=True)
|
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])
|
sign_headers.insert(0, ["(request-target)", "post %s" % parts.path])
|
||||||
signature = ap_security.signature(private_key, sign_headers)
|
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")
|
method="POST")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue