• Facebook
  • RSS Feed
  • Instagram
  • LinkedIn
  • Twitter
May 122011

A little while ago I did a 6 week stint in Enterprise Vault QA.  Whilst waiting for data to build, and fleshing out regression testing plans, generally getting all my ducks in a row, I thought it would be good if I could get my Enterprise Vault Server to send tweets when various things happen.

This article walks you through the things that need to be setup on the Enterprise Vault Server, and explains through the example of the running of the Provisioning Task how to send a Tweet.

Internet Needed

Normally all my environments for testing run in host-only mode VMWare.  Of course in order to reach out to Twitter.com, you’ve got to “get around” that and have a connection out to the internet.  For the purposes of these tests I added a second network card, running in a NAT configuration.  Essentially when I open a browser I can get to twitter.com.  If you want this to work you’ll need to be able to do the same.

Installation on the EV server :

Python (2.7 from http://www.python.org/download)

SetupTools (0.6c11 from http://pypi.python.org/pypi/setuptools) From that page choose the 2.7 installer for win32.


Tweepy (https://github.com/tweepy/tweepy)

Download the tweepy 1.7 file, and then extract it to c:tweepy

Configuration on the EV server

Add the python scripts folder to the path. You can do this permanently as follows (OS dependent, of course – this is Windows 2003):

Open Control Panel

Double click on System

Click the Advanced tab

Click Environment Variables

In System Environment Variables, locate “Path”

Click on, and click Edit

Add c:python27scripts to the beginning, followed by a semi-colon and click OK

Click OK again to close the System dialog

You can also just do it temporarily as follows :

  • Open a command prompt
  • Type path=%path%;c:python27scripts

Now go in to the Tweepy folder, and “install” it as follows :-

Setup.py install

It should run through something like this :

running install

running bdist_egg

running egg_info

creating tweepy.egg-info

writing tweepy.egg-infoPKG-INFO

writing top-level names to tweepy.egg-infotop_level.txt

writing dependency_links to tweepy.egg-infodependency_links.txt

writing manifest file ‘tweepy.egg-infoSOURCES.txt’

reading manifest file ‘tweepy.egg-infoSOURCES.txt’

writing manifest file ‘tweepy.egg-infoSOURCES.txt’

installing library code to buildbdist.win32egg

running install_lib

running build_py

creating build

creating buildlib

creating buildlibtweepy

copying tweepyapi.py -> buildlibtweepy

copying tweepyauth.py -> buildlibtweepy

copying tweepybinder.py -> buildlibtweepy

copying tweepycache.py -> buildlibtweepy

copying tweepycursor.py -> buildlibtweepy

copying tweepyerror.py -> buildlibtweepy

copying tweepymodels.py -> buildlibtweepy

copying tweepyoauth.py -> buildlibtweepy

copying tweepyparsers.py -> buildlibtweepy

copying tweepyrob.py -> buildlibtweepy

copying tweepystreaming.py -> buildlibtweepy

copying tweepyutils.py -> buildlibtweepy

copying tweepy__init__.py -> buildlibtweepy

creating buildbdist.win32

creating buildbdist.win32egg

creating buildbdist.win32eggtweepy

copying buildlibtweepyapi.py -> buildbdist.win32eggtweepy

copying buildlibtweepyauth.py -> buildbdist.win32eggtweepy

copying buildlibtweepybinder.py -> buildbdist.win32eggtweepy

copying buildlibtweepycache.py -> buildbdist.win32eggtweepy

copying buildlibtweepycursor.py -> buildbdist.win32eggtweepy

copying buildlibtweepyerror.py -> buildbdist.win32eggtweepy

copying buildlibtweepymodels.py -> buildbdist.win32eggtweepy

copying buildlibtweepyoauth.py -> buildbdist.win32eggtweepy

copying buildlibtweepyparsers.py -> buildbdist.win32eggtweepy

copying buildlibtweepyrob.py -> buildbdist.win32eggtweepy

copying buildlibtweepystreaming.py -> buildbdist.win32eggtweepy

copying buildlibtweepyutils.py -> buildbdist.win32eggtweepy

copying buildlibtweepy__init__.py -> buildbdist.win32eggtweepy

byte-compiling buildbdist.win32eggtweepyapi.py to api.pyc

byte-compiling buildbdist.win32eggtweepyauth.py to auth.pyc

byte-compiling buildbdist.win32eggtweepybinder.py to binder.pyc

byte-compiling buildbdist.win32eggtweepycache.py to cache.pyc

byte-compiling buildbdist.win32eggtweepycursor.py to cursor.pyc

byte-compiling buildbdist.win32eggtweepyerror.py to error.pyc

byte-compiling buildbdist.win32eggtweepymodels.py to models.pyc

byte-compiling buildbdist.win32eggtweepyoauth.py to oauth.pyc

byte-compiling buildbdist.win32eggtweepyparsers.py to parsers.pyc

byte-compiling buildbdist.win32eggtweepyrob.py to rob.pyc

byte-compiling buildbdist.win32eggtweepystreaming.py to streaming.pyc

byte-compiling buildbdist.win32eggtweepyutils.py to utils.pyc

byte-compiling buildbdist.win32eggtweepy__init__.py to __init__.pyc

creating buildbdist.win32eggEGG-INFO

copying tweepy.egg-infoPKG-INFO -> buildbdist.win32eggEGG-INFO

copying tweepy.egg-infoSOURCES.txt -> buildbdist.win32eggEGG-INFO

copying tweepy.egg-infodependency_links.txt -> buildbdist.win32eggEGG-INFO

copying tweepy.egg-infotop_level.txt -> buildbdist.win32eggEGG-INFO

copying tweepy.egg-infozip-safe -> buildbdist.win32eggEGG-INFO

creating dist

creating ‘disttweepy-1.7.1-py2.7.egg’ and adding ‘buildbdist.win32egg’ to it

removing ‘buildbdist.win32egg’ (and everything under it)

Processing tweepy-1.7.1-py2.7.egg

Copying tweepy-1.7.1-py2.7.egg to c:python27libsite-packages

Adding tweepy 1.7.1 to easy-install.pth file

Installed c:python27libsite-packagestweepy-1.7.1-py2.7.egg

Processing dependencies for tweepy==1.7.1

Finished processing dependencies for tweepy==1.7.1

Twitter Setup

Setup a new Twitter account, for example http://twitter.com/evtest123

Twitter Configuration via Tweepy

You can’t tweet from a command line as easily as you used to be able to, you now have to use OAuth. Here is how to set it up (it can be done on any machine with Tweepy configured, and then the files can be copied to the EV server!)

Get the PIN

Login to Twitter, and then in a new tab, go to http://dev.twitter.com/apps  to register a new API app with Twitter.com.  Click on Register a new application. You might have to log in to the Twitter site first, if you’re not already.

Fill in the registration fields as follows:


Note: whatever you specify for Application Name will be the “via” name your followers see in the details of tweets issued from your command line app:


Also note that for the website, you can put something like http://someplace.com.  It doesn’t have to be a real place.

You can check what has happened so far by going to : http://dev.twitter.com/apps

Check that the application will allow you to post, and that it is not read only.

Put the following in to a python file, and run it :

#!/usr/bin/env python

import tweepy

CONSUMER_KEY = ‘something’

CONSUMER_SECRET = ‘something’

auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)

auth_url = auth.get_authorization_url()

print ‘Please authorize: ‘ + auth_url

verifier = raw_input(‘PIN: ‘).strip()


print "ACCESS_KEY = ‘%s’" % auth.access_token.key

print "ACCESS_SECRET = ‘%s’" % auth.access_token.secret

You will get the CONSUMER_KEY and CONSUMER_SECRET from the API page after you register the API app, or by going to the link above (http://dev.twitter.com/apps) when logged in.   You need to edit the script you create (eg startme.py) and put in the :



.. or it won’t work !

Run the script, and you’ll get a prompt like this :


Paste the URL in to a browser, and it will give you a PIN.   Make sure that the information on the page that is displays says you will be able to post tweets.   Note that the URL changes each time you run the above script, so if you run the above script, and get the PIN wrong when entering it back, you have to run the .py file again, and get a new URL, and a new PIN.

Put the PIN in, and press return.

You will get an ACCESS_KEY and ACCESS_SECRET back.

Testing sending a tweet

You can now use a script like this, to send a tweet!

#!/usr/bin/env python

import sys

import tweepy

CONSUMER_KEY = ‘something’

CONSUMER_SECRET = ‘something’

ACCESS_KEY = ‘something’

ACCESS_SECRET = ‘something’

auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)

auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)

api = tweepy.API(auth)


You run it using :-

  • Save the above text to a file called tweetme.py in the tweepy directory and then from a DOS prompt:
  • Tweetme.py “This is a test tweet”


For this you need to have eventtrigger installed on the EV Server. Refer to this for help :


Once you have it setup, you should then do the following :-

In the c:tweepy folder create a file called tweepy.cmd

The contents should be something like this :

@echo off

Echo Running….

Set thestring=Provisioning just finished on evault01 %date% %time%

Echo %thestring%

C:tweepytweepytweetme.py “%thestring%”

Echo Finished.

Test it by running tweepy.cmd a few times, and checking twitter.

You then configure the “watcher” as follows :

Eventtriggers /create /TR “Tweetme” /l “Symantec Enterprise Vault” /eid 41104 /t Information /tk “c:tweepytweepy.cmd”

Test it a couple of times by running the provisioning task, and checking the event log, and twitter.

References :


If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>