def send_follow(self, sender, signature, now): c = Client() return c.post( urlsplit(self.rat.inbox).path, data=get_follow_request( sender, self.rat, ), content_type='application/json', **{ 'HTTP_DATE': now, 'HTTP_SIGNATURE': signature, 'HTTP_CONTENT_TYPE': 'application/activity+json; charset=utf-8', 'HTTP_HOST': DOMAIN, } )
def handle_follow(user, to_follow): ''' someone local wants to follow someone ''' activity = activitypub.get_follow_request(user, to_follow) broadcast(user, activity, [to_follow.inbox])
def get_follow_data(follower, followee): return json.dumps(get_follow_request(follower, followee)).encode('utf-8')
def handle_outgoing_follow(user, to_follow): ''' someone local wants to follow someone ''' activity = activitypub.get_follow_request(user, to_follow) errors = broadcast(user, activity, [to_follow.inbox]) for error in errors: raise (error['error'])
def handle_follow(user, to_follow): ''' someone local wants to follow someone ''' activity = activitypub.get_follow_request(user, to_follow) broadcast(user, activity, direct_recipients=[to_follow])