/srv/irclogs.ubuntu.com/2014/05/18/#launchpad.txt

lazyPowerwgrant: That's in context of the python launchpadlib no?17:54
lazyPowerOH! each resource has a ws.op parameter that gives you access to the subresources! AWESOME! *lightbulb*18:05
lazyPoweror not, this is error output :(18:06
cjwatsonws.op is how method names are passed to the LP webservice18:49
cjwatsonbasically18:49
cjwatsonIt's probably simplest to run the Python code with httplib2.debuglevel = 1, which will give you a dump of the request/response headers18:52
cjwatsonFor example that gives me http://paste.ubuntu.com/7485053/18:52
cjwatson(IME driving the API by hand rather than via bindings is doing things unnecessarily the hard way, but maybe you have a good reason ...)18:53
lazyPowercjwatson: i'm building a ruby gem with an attempt to get feature parity with pythons launchpadlib19:24
lazyPowerthere's a goldmine of data in here, and i'm not writing my project in python - so the only feesable way to go about this was to start translating the api into another wrapper :)19:25
lazyPowercjwatson: actually i spoke too soon. I'm making really good headway with the readonly client code20:06
lazyPowerhttps://github.com/chuckbutler/rlaunchpadlib - if you'd like to view the progress as it evolves. I'm open to any CR's / critique in what i have as a skeleton for the project.20:07
ehoovercould someone possibly investigate why https://code.launchpad.net/~vcs-imports/wine/master-git isn't updating?20:56
=== zequence_ is now known as zequence
cjwatsonlazyPower: ah, right, writing bindings for another language is one of the few good reasons :)21:29
cjwatsonlazyPower: I don't speak ruby so probably not much point in me looking too hard, though21:29
cjwatsonlazyPower: but good luck21:29
cjwatsonlazyPower: I'd generally recommend mimicking the property of launchpadlib where, as far as possible, all the API is server-side and the client code just defines how to translate your language's syntax into webservice calls - that is, I wouldn't expect to see names of specific methods in a bindings library21:32
cjwatsonit's probably not a good idea to rename things as people are going to work off the +apidoc and renaming confuses things21:32
=== nesthib is now known as Guest22056
=== Guest22056 is now known as nesthib
lazyPowercjwatson: hmm good feedback.22:48
xnoxlazyPower: well, first thing that launchpadlib does is download the wadl description of the API in XML.22:49
xnoxlazyPower: it's not quite standard Java WADL, thus a special parser is required.22:49
lazyPowerxnox: thats why i'm avoiding that file like the plague22:50
xnoxlazyPower: that xml is the goldmine, since one points the client-binding library at the url e.g. api.launchpad.net and then you can get resources, urls, methods, etc.22:50
xnoxlazyPower: yeah, i'm trying to write launchpadlib in python3, and so far i was avoiding that file as well.22:50
lazyPowerxnox: Why isn't it an a-typical WSDL then?22:50
lazyPowerits a standard document :|22:50
lazyPowerthen i could have done something like, import savant and consumed that wsdl and called it a day.22:51
xnoxlazyPower: assuming that "everyone can look at the docs online", but e.g. you do need to cache at least which methods are post/get/patch/update. Cause if one creates an object for e.g. ubuntu and somebody calls a method from the docs on it, you wouldn't want to guess each time if it's a get or post and just execute the right one.22:52
lazyPowerxnox: thats fair. I have a v1 implementation roadmap of readonly, so i dont have to stress over the proper rest method to use, and i'm not mucking about with authenticated api oauth schenanigans.22:52
lazyPowerthat's on the map for 2.x22:52
xnoxlazyPower: i don't know about savant, the only major difference is that instead of just using normal wadl xml tags like <_tag_>, it has <wadl:_tag_>22:52
xnoxlazyPower: so when i tried to validate it with some 3rd party wadl parsers it failed.22:53
lazyPowerI may be letting my soap show....22:53
xnoxlazyPower: and there is no python3 wadl parsers at all.22:53
lazyPowersince wsdl is specific to soap22:53
xnoxlazyPower: oh, the oauth shenaningans are also non-standard on launchpad. I've discovered that and submitted a fix, but that's not deployed yet.22:54
lazyPowerYeah. I'm going for all the low hanging fruit that I can manage before I dive into the non-standard implementations.22:54
xnoxlazyPower: use plaintext signatures, and at the last token exchange one _must_ use body signature authentication method at the moment.22:54
lazyPowermy use case really doesn't have need for any of the authenticated api routines, or put. Its all get, and public projects.22:55
xnoxlazyPower: go for annnonimous things for now.22:55
lazyPoweroh wow, thats... interesting.22:55
lazyPowerlet me note that so if i run into it i know why, because body signature would throw me22:55
xnoxyeah, i have a fix for it, but it fails test-suite and opens up a huge security hole =(22:55
xnoxso not merged yet. status - work in progress.22:55
xnoxlazyPower: let me paste you a script of mine.22:56
xnoxlazyPower: http://paste.ubuntu.com/7485944/ -> that should work with unreleased requests_oauthlib under python3.22:58
xnoxlazyPower: but it does show required options & urls to use, and client tokens to request, and things to ignore (e.g. empty verifier, etc.)22:59
lazyPowernotbadobama.gif23:01
wgrantxnox: What's non-standard about our WADL?23:05
wgrantIt has some extensions, but it shouldn't be otherwise non-standard.23:05
wgrantAlso, WADL, not WSDL. We're not a SOAP API.23:05
wgrantlazyPower: You really need to not hardcode the structure of the API. Things are added frequently and occasionally changed.23:06
lazyPowerI would have thought that if something broke, it would constitute a new version of the API23:09
lazyPowers/broke/changed that dramatically/23:10
xnoxlazyPower: not really, since the clients are meant to download the wadl and act according to what they've downloaded.23:10
xnoxwgrant: the tags used are not per spec, as far as i can see we prefix all tag names with "wadl:" when we shouldn't*. [*] shouldn't means that the parsers i've tried to use failed to parse it, yet they work fine against wadls as generated by common java-webapps.23:11
xnoxand i've decided against rewritting a wadl parser in python3, and instead try to create python3 REST bindings using like standard library + requests and nothing else.23:12
lazyPower^ thats pretty much the route i'm taking23:13
xnoxs/python3/ruby/ =)23:13
lazyPowerI'm in a discovery session with pry scoping the wadl gem though23:14
lazyPowerif this reduces overall code, i'll go that route. But i'm concerned with your reprted findings on python3 wadl parsers23:14
wgrantxnox: Erm, that's pretty basic XML23:15
wgrantWe bind the WADL namespace to xmlns:wadl23:16
xnoxwgrant: i see. well i must have been using crappy parser then.23:16
xnoxdidn't know about namespaces, read up on it now. looks useful, yet i've never seen/needed to use them.23:18
wgranthttp://bazaar.launchpad.net/~lazr-developers/wadllib/trunk/view/head:/src/wadllib/application.py is our parser. We also have a client with a different API that doesn't use WADL at all, for testing the server code without launchpadlib: http://bazaar.launchpad.net/~lazr-developers/lazr.restful/trunk/view/head:/src/lazr/restful/testing/webservice.py#L22723:20
wgrantThe entire client stack is in lp:wadllib, lp:lazr.restfulclient, and lp:launchpadlib23:20
wgrantRoughly 1000, 2000 and 1500 lines of Python each.23:21
xnoxright, but when barry tried to tackle porting the client stack it wound up in porting all the deps (lazr.*) which ultimately didn't work.23:41
wgrantYeah, the problem is that lazr.restfulclient has a test dependency on lazr.restful.23:41
wgrantWhich ends up pulling in a good portion of zope.app, despite the fact that lazr.restfulclient only needs to talk to lazr.restful over a network socket.23:41
xnoxthanks for pointers to these, looks very good and small indeed.23:42
xnoxwgrant: hm..... can i keep lazr.restful in python2, yet have lazr.restfulclient in python3 talking to it?23:42
xnoxit's all bytes over the wire.....23:42
wgrantxnox: It requires changes to the test suite, but that's what we should be doing, yes.23:42
wgrantCurrently it relies on being able to run lazr.restful in-process, and obtains it using buildout.23:43
xnoxwgrant: i'd take bolting on crazy hacks to existing thing any day, over writing things from scratch. Just a trivial attempt at getting to +me resulted in bugs to: python requests, requests_oauthlib, and launchpad.23:47
xnox(requests_oauthlib was hilariously reusing oauthentication upon redirect resulting in denies)23:48
wgrantYeah, a couple of libraries in other languages have had that same problem.23:49
wgrantAnd that one's *not* our fault :)23:49
xnoxi loved the response "most other sites, do internal resolution, and return correct data without redirecting"23:51
xnoxi am like "dude it's http, i can return any redirect i want" =)))) and then the fun bugs about serving different content from same URLs as recently demoend in django.23:51
xnoxoh if you are online and working, I should be asleep long time ago!23:56
xnoxgood night.23:56
wgrantHeh, night23:57

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!