You are using the following configuration:
* credentials: <launchpadlib.credentials.Credentials object at 0x1830410>
* service: https://api.staging.launchpad.net/beta/
* cache: /home/markus/.launchpadlib/cache
In [4]: bug.http_etag
Out[4]: u'"34f56522b90d32202b1c3d8a7c96cb6d093ed11b"'
For a following bug.lp_save() launchpadlib will use the "34f[...]" etag which is different to the etag on the server, this means "resource changed after request was send", which results in a precondition error
I did some debugging, and for me it looks like the http_etag attribute of an entry object is not updated properly as a result of a SEND request
markus@thekorn ~ % launchpad-shell --debug launchpad. net:443\ r\nAccept- Encoding: identity\ r\nAuthorizatio n: OAuth realm="https:/ /api.launchpad. net", oauth_nonce= "92420252" , oauth_timestamp ="1237192827" , oauth_consumer_ key="just testing", oauth_signature _method= "PLAINTEXT" , oauth_version= "1.0", oauth_token= "DKXXXXXXXX" , oauth_signature ="&cNYYYYYYY" \r\nif- none-match: "6824f160547b20 004d582a2e240f8 317e4304abd" \r\nte: deflate, gzip\r\naccept: application/ vd.sun. wadl+xml\ r\nuser- agent: Python- httplib2/ $Rev: 259 $\r\n\r\n' 004d582a2e240f8 317e4304abd" Authorization, Accept launchpad. net:443\ r\nAccept- Encoding: identity\ r\nAuthorizatio n: OAuth realm="https:/ /api.launchpad. net", oauth_nonce= "63109900" , oauth_timestamp ="1237192833" , oauth_consumer_ key="just testing", oauth_signature _method= "PLAINTEXT" , oauth_version= "1.0", oauth_token= "DKXXXXXXXX" , oauth_signature ="&cNYYYYYYY" \r\nif- none-match: "77546fc558d4a8 11ad4f71a3495af 2e410a87c52" \r\nte: deflate, gzip\r\naccept: application/ json\r\ nuser-agent: Python- httplib2/ $Rev: 259 $\r\n\r\n' 11ad4f71a3495af 2e410a87c52" Authorization, Accept
send: 'GET /beta/ HTTP/1.1\r\nHost: api.staging.
reply: 'HTTP/1.1 304 Not Modified\r\n'
header: Date: Mon, 16 Mar 2009 08:40:28 GMT
header: Server: zope.server.http (HTTP)
header: Etag: "6824f160547b20
header: Vary: Cookie,
send: 'GET /beta/ HTTP/1.1\r\nHost: api.staging.
reply: 'HTTP/1.1 304 Not Modified\r\n'
header: Date: Mon, 16 Mar 2009 08:40:34 GMT
header: Server: zope.server.http (HTTP)
header: Etag: "77546fc558d4a8
header: Vary: Cookie,
Welcome to launchpad-shell - an interactive shell using launchpadlib
You are using the following configuration: credentials. Credentials object at 0x1830410> /api.staging. launchpad. net/beta/ .launchpadlib/ cache
* credentials: <launchpadlib.
* service: https:/
* cache: /home/markus/
In [1]: bug = launchpad. bugs[123456] launchpad. net:443\ r\nAccept- Encoding: identity\r\nte: deflate, gzip\r\ nAuthorization: OAuth realm="https:/ /api.launchpad. net", oauth_nonce= "10785042" , oauth_timestamp ="1237192858" , oauth_consumer_ key="just testing", oauth_signature _method= "PLAINTEXT" , oauth_version= "1.0", oauth_token= "DKXXXXXXXX" , oauth_signature ="&cNYYYYYYY" \r\naccept: application/ json\r\ nuser-agent: Python- httplib2/ $Rev: 259 $\r\n\r\n' launchpad. net:443\ r\nAccept- Encoding: identity\r\nte: deflate, gzip\r\ nAuthorization: OAuth realm="https:/ /api.launchpad. net", oauth_nonce= "10785042" , oauth_timestamp ="1237192858" , oauth_consumer_ key="just testing", oauth_signature _method= "PLAINTEXT" , oauth_version= "1.0", oauth_token= "DKXXXXXXXX" , oauth_signature ="&cNYYYYYYY" \r\naccept: application/ json\r\ nuser-agent: Python- httplib2/ $Rev: 259 $\r\n\r\n' 202b1c3d8a7c96c b6d093ed11b" Authorization, Accept staging. launchpad. net
send: 'GET /beta/bugs/123456 HTTP/1.1\r\nHost: api.staging.
reply: ''
send: 'GET /beta/bugs/123456 HTTP/1.1\r\nHost: api.staging.
reply: 'HTTP/1.1 200 Ok\r\n'
header: Date: Mon, 16 Mar 2009 08:41:00 GMT
header: Server: zope.server.http (HTTP)
header: X-Powered-By: Zope (www.zope.org), Python (www.python.org)
header: Content-Type: application/json
header: Content-Length: 1918
header: Etag: "34f56522b90d32
header: Vary: Cookie,
header: Via: 1.1 wildcard.
In [2]: bug.http_etag 32202b1c3d8a7c9 6cb6d093ed11b" '
Out[2]: u'"34f56522b90d
In [3]: bug.newMessage( content= "Testing bug", subject="Testing add comment") launchpad. net:443\ r\nAccept- Encoding: identity\ r\nContent- Length: 76\r\ncontent-type: application/ x-www-form- urlencoded\ r\nAuthorizatio n: OAuth realm="https:/ /api.launchpad. net", oauth_nonce= "16919267" , oauth_timestamp ="1237192880" , oauth_consumer_ key="just testing", oauth_signature _method= "PLAINTEXT" , oauth_version= "1.0", oauth_token= "DKXXXXXXXX" , oauth_signature ="&cNYYYYYYY" \r\naccept: application/ json\r\ nuser-agent: Python- httplib2/ $Rev: 259 $\r\n\r\n' %22Testing+ bug%22& ws.op=newMessag e&subject= %22Testing+ add+comment% 22' Type-Warning: guessed from content /api.staging. launchpad. net/beta/ amarok/ +bug/123456/ comments/ 13 Authorization, Accept staging. launchpad. net +bug/123456/ comments/ 13 HTTP/1.1\r\nHost: api.staging. launchpad. net:443\ r\nAccept- Encoding: identity\ r\nAuthorizatio n: OAuth realm="https:/ /api.launchpad. net", oauth_nonce= "92760047" , oauth_timestamp ="1237192892" , oauth_consumer_ key="just testing", oauth_signature _method= "PLAINTEXT" , oauth_version= "1.0", oauth_token= "DKXXXXXXXX" , oauth_signature ="&cNYYYYYYY" \r\nif- none-match: "9af25b4bfebdd7 460fc573dbfd829 529bd060b93" \r\nte: deflate, gzip\r\naccept: application/ json\r\ nuser-agent: Python- httplib2/ $Rev: 259 $\r\n\r\n' 6c80a37ae427e68 825dd39a491" Authorization, Accept staging. launchpad. net /api.staging. launchpad. net/beta/ amarok/ +bug/123456/ comments/ 13>
send: 'post /beta/bugs/123456 HTTP/1.1\r\nHost: api.staging.
send: 'content=
reply: 'HTTP/1.1 201 Created\r\n'
header: Date: Mon, 16 Mar 2009 08:41:21 GMT
header: Server: zope.server.http (HTTP)
header: X-Powered-By: Zope (www.zope.org), Python (www.python.org)
header: X-Content-
header: Content-Length: 0
header: Location: https:/
header: Vary: Cookie,
header: Content-Type: text/plain
header: Via: 1.1 wildcard.
send: 'GET /beta/amarok/
reply: 'HTTP/1.1 200 Ok\r\n'
header: Date: Mon, 16 Mar 2009 08:41:33 GMT
header: Server: zope.server.http (HTTP)
header: X-Powered-By: Zope (www.zope.org), Python (www.python.org)
header: Content-Type: application/json
header: Content-Length: 567
header: Etag: "36f015400090b7
header: Vary: Cookie,
header: Via: 1.1 wildcard.
Out[3]: <message at https:/
In [4]: bug.http_etag 32202b1c3d8a7c9 6cb6d093ed11b" '
Out[4]: u'"34f56522b90d
For a following bug.lp_save() launchpadlib will use the "34f[...]" etag which is different to the etag on the server, this means "resource changed after request was send", which results in a precondition error
Markus