Showing results for 
Show  only  | Search instead for 
Did you mean: 

Export Watchlist Values


Exporting Watchlist gives me the xml file of the watchlist definitions.

how can I export watchlist actual values?

3 Replies
Level 9
Report Inappropriate Content
Message 2 of 4

Re: Export Watchlist Values



It's really simple, you can use the API python wrapper to leverage some of the private API calls and get the data we want.


The following python code snippet should be self-explanatory:


>>> from msiempy import WatchlistManager
>>> all_watchlists = WatchlistManager()
>>> my_test_wl = [ w for w in all_watchlists if w['name'] == 'TEST-watchlist'][0]
>>> my_test_wl.load_values()
>>> my_test_wl['values'] 
['::0', '', '', '', '']


I'm just unsure how many values at max you can get using this method.



Re: Export Watchlist Values

Hi, thank you

first time working with API

where do I need to execute this code snippet from??

Level 9
Report Inappropriate Content
Message 4 of 4

Re: Export Watchlist Values

1/ You should install python on your VM / computer:

2/ Install the python wrapper library: Open a terminal and type: 

python3 -m pip install msiempy

On windows the python executable might be named differently

3/ Try out the commands I shared from the Python Interpreter by launching

`python3` (or `py`) Without arguments.

4/ Read the library (`msiempy`) documentation  here: And make a python script for your use case. I.E the `` following :




import argparse
from msiempy import WatchlistManager

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Dump ESM Watchlist values to a text file.  ")
    parser.add_argument('--wl', help='ESM Watchlist name')
    parser.add_argument('--list','-l', action='store_true', help='List all Watchlists')
    parser.add_argument('--out', help='Output text file. Print only if none')
    all_watchlists = WatchlistManager()
    if args.list:
    if args.wl:
        my_wl = [ w for w in all_watchlists if w['name'] == args.wl]
        if not len(my_wl):
            raise ValueError("Watchlist not found")
        if args.out:
            with open(args.out, 'w') as o:
                #Write all values to file (edited)




This script is working and will export Watchlist values to text file. 



% python3 ./ -h               
usage: [-h] [--wl WL] [--list] [--out OUT]

Dump ESM Watchlist values to a text file.

optional arguments:
  -h, --help  show this help message and exit
  --wl WL     ESM Watchlist name
  --list, -l  List all Watchlists
  --out OUT   Output text file. Print only if none



 Cheers !

You Deserve an Award
Don't forget, when your helpful posts earn a kudos or get accepted as a solution you can unlock perks and badges. Those aren't the only badges, either. How many can you collect? Click here to learn more.

Community Help Hub

    New to the forums or need help finding your way around the forums? There's a whole hub of community resources to help you.

  • Find Forum FAQs
  • Learn How to Earn Badges
  • Ask for Help
Go to Community Help

Join the Community

    Thousands of customers use the McAfee Community for peer-to-peer and expert product support. Enjoy these benefits with a free membership:

  • Get helpful solutions from McAfee experts.
  • Stay connected to product conversations that matter to you.
  • Participate in product groups led by McAfee employees.
Join the Community
Join the Community