Client for memoQ server Web Service API

· by Peter · Read in about 3 min · (457 words)

I work a lot with memoQ Server, great translation tool. It has awesome Web Service API which covers almost all aspects of the server. It lacks CAL license management which is annoying. But on the other hand, it extends some functionality (for instance pre-translation), so you can do more than with memoQ Client. And it’s API, so you can automate a lot with it. To make life easier for myself I’ve created series of Python packages which serve as a client to this API.

I’ve not used it on production as we’re not allowed to use Python there, but I’ve put some effort to at least unit test all the methods. I’m sure that not all possible cases are covered though. All exceptions returned by the server are ignored which isn’t very professional. But firstly, it was created for my experiments where in 99% cases my code, not server, is the problem. Secondly, messages received from SOAP are not the most useful I’ve seen. Thirdly, OK, it’s simple laziness.

It’s not something you’ll want to use on production as-is, but it should get you started with the magic of this API as it’s not always so obvious how some things should be done. Server was written in C#, so if you’re consuming the API this way it’s much easier. Especially when it comes to special types. Python doesn’t care much about types as it’s dynamic language, but SOAP isn’t so forgiving. It’s often not enough to just pass the array (list), it must be exactly this type of array.

This was good exercise for me as I’ve finally installed pylint and had to refactor most of my code. Some of PEP8 rules seem strange if you ask me, but anyway I’ve tried to adhere to them. Not all of them, as it was not always possible, but to most. I’ve also realized how powerful and important unit tests are. Only when I was writing them I’ve discovered duplicated methods and some spaghetti code. Not that now it’s perfect, but at least it’s much better.

Packages (especially the one for project) are heavily customized to my needs, so I would suggest starting with the tests just to see how they work. Tests which create something on server (project, user) have self-cleanup, just to not create a mess. You may want to comment the line with delete method if you want to check given resource on the server.

Kilgray is constantly improving their products, so I would have to keep up. Also, I realize that some things could be done better on my side, but with my current knowledge I can’t exactly figure out how. I’ll try to get back to it while I proceed with my learning though.