'Writes QNetworkCookies to Mozilla cookie .txt file.
:return: The file path to the cookie file.'

def get_cookies(self):

    cf = PersistentTemporaryFile(suffix=u'.txt')
    cf.write(u'#    Netscape    HTTP    Cookie    File\n\n')
    for c in self.page().networkAccessManager().cookieJar().allCookies():
        cookie = []
        domain = unicode(c.domain())
        cookie.append(domain)
        cookie.append((u'TRUE' if domain.startswith(u'.') else u'FALSE'))
        cookie.append(unicode(c.path()))
        cookie.append((u'TRUE' if c.isSecure() else u'FALSE'))
        cookie.append(unicode(c.expirationDate().toTime_t()))
        cookie.append(unicode(c.name()))
        cookie.append(unicode(c.value()))
        cf.write(u' DCTB '.join(cookie))
        cf.write(u'\n')
    cf.close()
    return cf.name
