From the Burrow

Remote execute windows command from Ubuntu (psexec for linux)

2011-09-07 00:00:00 +0000

Hey all, just a quickly as this took a little googling.

If you need winexe to remote administer a windows box..

Grab a package from here: https://launchpad.net/~jdthood/+archive/winexe/+packages

Install it

Finally open a terminal and try:

winexe -U domain\username //machinename ‘cmd’

Also you may want to hunt down wmic (wmi-client), its also not in the repos, but is available to be compiled from zenoss.

If I find the guide for this again I’ll make another post about it.

Hope it helps!

The bestt thing on the internet

2011-09-04 00:00:00 +0000

Tonight I found a site called wiki summaries.

It summarises books.

There is a summary of green eggs and ham

READ IT!

Python, Suds and Microsoft Web Services

2011-08-30 00:00:00 +0000

Hey all,

If you need to interact with Microsoft Web Services from python grab suds from whatever repo you have handy and relax! I had a brief dabble with Soappy but it seems this is now deprecated and had a couple of issues.

Here is your quickstart to talk to a soap based .net web service with suds


from suds.client import Client

#chances are you have a asmx url, make sure you add

# ?wsdl on the end

url = "https://www.yourwebsite.org/yourwebservice/webservice.asmx?wsdl"

client = Client(url)

print client.service.yourMethod(args)

Hope it helps!

Cross platform Python AD Library on launchpad later this week!

2011-08-30 00:00:00 +0000

The code for my AD library ADdled will be uploaded later this week to this page.

It will have basic functionality for connecting, searching and retrieving data and the beginnings of the write-back methods.

I’ll be expanding this along with pressly over the coming weeks in order to get them up towards something I’d be happy calling a beta.

In that time I also need to get myself familiar with the unittest system for python as I want to have decent test coverage. One thing I don’t know yet is how to write decent tests for systems that require login details…ah well I’m sure that will be revealed soon enough!

Goodnight all!

Pressly goes live!

2011-08-29 00:00:00 +0000

And we are up on launchpad, got to say the information provided by the Ubuntu Developer week logs was stellar and really helped me get going.

I’m much more used to writing things either just for work or for my own use so getting code out there in this way feel great.

For those who want to have a tinker, you can find it here.

I’m also beavering away at getting my Active Directory library up on line soon. I’ll keep you posted on that as it develops.

Thats what I'm talking about!

2011-08-26 00:00:00 +0000

Dammit, sometimes it just all seems to fall into place.

Just 2 minutes ago, I realised I hadn’t tagged the last 4 posts and so I thought I best test the library:


for index,post in list(enumerate(blog[:4])):

	post["tags"]=["python","wordpress"]

	blog[index]=post

That’ll do just fine!

Right, next stop.. comments!

Fun with Tags

2011-08-26 00:00:00 +0000

As I mentioned a few posts back, tags are a bit weird. I had assumed that you would be able to query for a list of posts belonging to a certain tag but apparently not.

What I have gone for instead is to scrape the rss feed for the tag, and from that grab the post ids.

As there could be hundreds the call returns post objects which behave like dicts but can retrieve the data from the server as it is accessed.

So to grab all the posts tagged ‘python’ and print the body text of the first post you can do this:


tagged_posts = blog["python"]

print tagged_posts[0]["body"]

Simple!

Editing a post

2011-08-26 00:00:00 +0000

Here’s what you do to change a post’s title with my library:

# get most recent post

post = blog[0]



# edit the posts title

post.title = "hey a new title!"



# push post back to blog

blog[0] = post

Tags are an interesting beasty with wordpress, I can’t query for all posts with a tag, but I can get the rss feed for a tag, so I’m hoping I can pull the info from there.

Will keep ye posted

API Changes

2011-08-26 00:00:00 +0000

Hey folks,

Made some changes to keep things a native as possible.

Posts behave as dicts now, to make a post you now just have to write:


post= {"title": "example title",

		"body": "example body text",

		"tags": ["wordpress", "api", "python"],

		"live": True}

blog.append(post)

Internally the library uses a dict like object to present posts but that is just so that some data can be retrieved lazily.

I’m close to an beta release now so I’m really going to have to hurry up and get on launchpad!

test post

2011-08-25 00:00:00 +0000

Test text New line Conclusion…BYE!

Mastodon