Exemplo n.º 1
0
 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,
         }
     )
Exemplo n.º 2
0
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])
Exemplo n.º 3
0
def get_follow_data(follower, followee):
    return json.dumps(get_follow_request(follower, followee)).encode('utf-8')
Exemplo n.º 4
0
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'])
Exemplo n.º 5
0
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])