Re: metaweblog again.

darryl <[email protected]> Sat, 01 Nov 2003 19:28:45 -0800
Newsgroups gmane.comp.web.syncato.general
Message-ID <[email protected]>
Kimbro Staken wrote:

> I'm not sure what you're asking?
>
> BTW, was there some reason this has gone off-list?
>
> On Oct 31, 2003, at 8:54 PM, darryl wrote:
>
>>
>> You can just use the network and HTTP POST categories too no?
>>
>> -darryl
>
 Just wondering if you can 'POST' categories (my terminology is not good)
like below:
--------------------------------------------------------------
import httplib
import libxml2
import sys
entry = """<category id="XML">
   <title>XML</title>
  <description>Stuff about XML</description>
</category>
"""

def runRequest(method,url,body=None):
    conn = httplib.HTTPConnection("localhost")
    headers = {"Content-type": "text/xml"}
    conn.request(method, url, body, headers)

    result = conn.getresponse()

    if (result.status == 401):
        token = "Basic " + encodestring(USERNAME + ":" + PASSWORD).strip()
        headers = {"Content-type": "text/xml", "Authorization": token}
        conn.close()

        conn.request(method,url,body,headers)

        result = conn.getresponse()

    return result
baseURL = "htp://localhost/WK/blog/"
result = runRequest("POST",baseURL,entry)
print result.status, result.reason

-------------------------------------------------------------

above doesn't really work as it doesn't yield categories like on your 
site :)

 No reason to go off-list, i guess i did a reply instead of reply-all.

-cheers
darryl




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/