Re: metaweblog again.
darryl <[email protected]> Sun, 02 Nov 2003 10:52:07 -0600
| Newsgroups | gmane.comp.web.syncato.general |
|---|---|
| Message-ID | <[email protected]> |
hmm,
what my script yields is something like this:
<category dbxml:id="113" id="607">
<title>XML</title>
<description>Stuff about XML</description>
<pubDate seconds="1067754035.05">2003-11-02T00:20:35-07:00</pubDate>
</category>
The templates rely on the id attribute being set to something like
'XML' rather than the autogenerated numerical one.
-darryl
> That should work, that's all addCategory.py does anyway.
>
> On Nov 1, 2003, at 8:28 PM, darryl wrote:
>
>>>>
>>>
>> 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
>>
>> -------------------------------------------------------------
>
-------------------------------------------------------
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/