def publish(self, path):
        """Publish file or folder and return public url"""
        
        def parseContent(content):
            root = ET.fromstring(content)
            prop = root.find(".//d:prop", namespaces=self.namespaces)
            return prop.find("{urn:yandex:disk:meta}public_url").text.strip()
        
        data = """
<propertyupdate xmlns="DAV:">
  <set>
    <prop>
      <public_url xmlns="urn:yandex:disk:meta">true</public_url>
    </prop>
  </set>
</propertyupdate>
        """
        
        _check_dst_absolute(path)
        resp = self._sendRequest("PROPPATCH", addUrl=path, data=data)
        if resp.status_code == 207:
            return parseContent(resp.content)
        else:
            raise YaDiskException(resp.status_code, resp.content)
def publish ( self , path ) : def parseContent ( content ) : root = ET . fromstring ( content ) prop = root . find ( ".//d:prop" , namespaces = self . namespaces ) return prop . find ( "{urn:yandex:disk:meta}public_url" ) . text . strip ( ) data = """
<propertyupdate xmlns="DAV:">
  <set>
    <prop>
      <public_url xmlns="urn:yandex:disk:meta">true</public_url>
    </prop>
  </set>
</propertyupdate>
        """ _check_dst_absolute ( path ) resp = self . _sendRequest ( "PROPPATCH" , addUrl = path , data = data ) if resp . status_code == 207 : return parseContent ( resp . content ) else : raise YaDiskException ( resp . status_code , resp . content )
Publish file or folder and return public url