updateInfoPleroma.py
def pin_pleroma(self, id_post):
        """Tries to unpin previous pinned post if a file containing the ID of the previous post exists, then
        proceeds to pin the post with ID 'id_post'

        :param id_post: ID of post to pin
        :returns: ID of post pinned
        :rtype: str
        """
        if os.path.isfile(os.path.join(self.user_path, 'pinned_id_pleroma.txt')):
            with open(os.path.join(self.user_path, 'pinned_id_pleroma.txt'), 'r') as file:
                previous_pinned_post_id = file.readline().rstrip()
                unpin_url = self.pleroma_base_url + '/api/v1/statuses/' + previous_pinned_post_id + '/unpin'
                response = requests.post(unpin_url, headers=self.header_pleroma)
                if not response.ok:
                    response.raise_for_status()
                print("Unpinning previous:\t" + response.text)
        pin_url = self.pleroma_base_url + '/api/v1/statuses/' + id_post + '/pin'
        response = requests.post(pin_url, headers=self.header_pleroma)
        print("Pinning post:\t" + str(response.text))
        try:
            pin_id = json.loads(response.text)['id']
        except KeyError:
            pin_id = None
            pass
        return pin_id
Tries to unpin previous pinned post if a file containing the ID of the previous post exists, then
        proceeds to pin the post with ID 'id_post'

        :param id_post: ID of post to pin
        :returns: ID of post pinned
        :rtype: str
        
Tries to unpin previous pinned post if a file containing the ID of the previous post exists, then
proceeds to pin the post with ID 'id_post'
Tries to unpin previous pinned post if a file containing the ID of the previous post exists then proceeds to pin the post with ID ' id_post '
def pin_pleroma(self, id_post):
        if os.path.isfile(os.path.join(self.user_path, 'pinned_id_pleroma.txt')):
            with open(os.path.join(self.user_path, 'pinned_id_pleroma.txt'), 'r') as file:
                previous_pinned_post_id = file.readline().rstrip()
                unpin_url = self.pleroma_base_url + '/api/v1/statuses/' + previous_pinned_post_id + '/unpin'
                response = requests.post(unpin_url, headers=self.header_pleroma)
                if not response.ok:
                    response.raise_for_status()
                print("Unpinning previous:\t" + response.text)
        pin_url = self.pleroma_base_url + '/api/v1/statuses/' + id_post + '/pin'
        response = requests.post(pin_url, headers=self.header_pleroma)
        print("Pinning post:\t" + str(response.text))
        try:
            pin_id = json.loads(response.text)['id']
        except KeyError:
            pin_id = None
            pass
        return pin_id
def pin_pleroma ( self , id_post ) : if os . path . isfile ( os . path . join ( self . user_path , 'pinned_id_pleroma.txt' ) ) : with open ( os . path . join ( self . user_path , 'pinned_id_pleroma.txt' ) , 'r' ) as file : previous_pinned_post_id = file . readline ( ) . rstrip ( ) unpin_url = self . pleroma_base_url + '/api/v1/statuses/' + previous_pinned_post_id + '/unpin' response = requests . post ( unpin_url , headers = self . header_pleroma ) if not response . ok : response . raise_for_status ( ) print ( "Unpinning previous:\t" + response . text ) pin_url = self . pleroma_base_url + '/api/v1/statuses/' + id_post + '/pin' response = requests . post ( pin_url , headers = self . header_pleroma ) print ( "Pinning post:\t" + str ( response . text ) ) try : pin_id = json . loads ( response . text ) [ 'id' ] except KeyError : pin_id = None pass return pin_id
Tries to unpin previous pinned post if a file containing the ID of the previous post exists, then
proceeds to pin the post with ID 'id_post'
Tries to unpin previous pinned post if a file containing the ID of the previous post exists then proceeds to pin the post with ID ' id_post '
"""Tries to unpin previous pinned post if a file containing the ID of the previous post exists, then
        proceeds to pin the post with ID 'id_post'

        :param id_post: ID of post to pin
        :returns: ID of post pinned
        :rtype: str
        """
ID of post pinned
ID of post pinned
str
self
id_post
ID of post to pin
ID of post to pin