SlideShare a Scribd company logo
1 of 68
20 Cool Things I
           have done in Python

                          Maurice Maneschi
                          RedWaratah.com




RedWaratah.com
Open Source Solutions for Business
Who am I
●
    I am a former mainframe developer
●
    I work for Financial Advisory company
●
    All Microsoft and Excel
●
    However, Python gives me a tool kit that easily
    solves dvierse, apparently intractable data and
    integration problems
●
    I am a hero for the problems I can solve

     RedWaratah.com
     Open Source Solutions for Business
Format
●
    I will fly through 20 examples of what I have done
●
    Slow me down for the interesting slides, speed me up
    for the boring ones
●
    For details, grab me afterwards over coffee
●
    See the key libraries on the bottom right
    –   Search the web for samples
    –   Send me email anything@redwaratah.com




        RedWaratah.com
        Open Source Solutions for Business
Configuration
●
    Python header
●
    Command line
●
    INI file
●
    Windows Registry




     RedWaratah.com
     Open Source Solutions for Business
Configuration – in the header




RedWaratah.com
Open Source Solutions for Business
Configuration – command line




RedWaratah.com
Open Source Solutions for Business
                                     Using argparse library
Configuration – ini file




RedWaratah.com
Open Source Solutions for Business
                                     Using configparser library
Configuration – Windows registry




 RedWaratah.com
 Open Source Solutions for Business
                                      Using winreg library
Using DLLs
●
    I had to debug a Windows program in
    production without a debugger
●
    Using Python ctypes, I called each subroutine
    until I discovered the defect




     RedWaratah.com
     Open Source Solutions for Business
Using DLLs




RedWaratah.com
Open Source Solutions for Business
                                           Using ctypes library
Driving a website
●
    Single window website for MSIE only
●
    Running reports is fiddly, same report routinely
    is painful
●
    Python proxy server to log the responses
●
    I built an application that mimicked the
    browser and download the reports in PDF and
    Excel

     RedWaratah.com
     Open Source Solutions for Business
Driving a web site – part 1




RedWaratah.com
Open Source Solutions for Business
                                     Using urllib, html, http and re libraries
Driving a web site – part 2




RedWaratah.com
Open Source Solutions for Business
Regular Expression Log Parsing
●
    MS IIS logs are nightly copied to a folder
●
    Python uses RE to capture log ons and report runs
●
    Converts IP address to client name via firewall config
●
    Saves the data to an SQLite database
●
    This data is provided regularly to the wiki article on
    active clients




      RedWaratah.com
      Open Source Solutions for Business
Regular Expression Log Parsing




RedWaratah.com
Open Source Solutions for Business
                                     Using re, sqlite3 libraries
Regular Expression Magic
●
    We have the Mediawiki (Wikipedia) for documentation
    and TestTrack for defect tracking
●
    Python does a nightly read of the wiki articles and builds
    a huge regular expression (3 actually) of all titles
●
    Python does a nightly extract of the contents of
    TestTrack to HTML and hyper links any reference to the
    articles back to the wiki




      RedWaratah.com
      Open Source Solutions for Business
Regular Expression Magic - pt1




RedWaratah.com
Open Source Solutions for Business
                                     Using re, subprocess libraries
Regular Expression Magic – pt 2




RedWaratah.com
Open Source Solutions for Business
Scheduled Task Status
●
    We have about 30 scheduled tasks that run
    each day (or more frequently)
●
    Python scans the status return codes every 5
    minutes and puts the results into a CSV files
●
    MSDN defines the format of the job files and
    Python can read these formats
●
    Nagios warns if any status codes are not 0

     RedWaratah.com
     Open Source Solutions for Business
Scheduled Task Status




RedWaratah.com
Open Source Solutions for Business
                                     Using struct, csv libraries
Scheduled Task Status




RedWaratah.com
Open Source Solutions for Business
Static Data Checker
●
    Our key software tool does not audit every
    Static Data table
●
    Changes can happen inadvertently
●
    Python reads every nominated table, pickles
    each row and pops the results into an SQLite
    table
●
    Daily report of new, changed or deleted rows

     RedWaratah.com
     Open Source Solutions for Business
Static Data Checker

                                Row
Static data
                                              Pickle


                     Key              Value




                                                          SQlite




RedWaratah.com
Open Source Solutions for Business
                                                Using adodb, pickle, sqlite3 libraries
Static Data Checker




RedWaratah.com
Open Source Solutions for Business
Static Data Checker




RedWaratah.com
Open Source Solutions for Business
Conan: Flagging required email
●
    Purchased Software is meant to send email
    confirming financial transactions that we track
●
    It fails to correctly ascertain settlements
●
    Python creates a web site that shows which
    settlements have to be sent
●
    Annotations
●
    Validates against the transmission logs

     RedWaratah.com
     Open Source Solutions for Business
Conan




RedWaratah.com
Open Source Solutions for Business
                                             Using html, cgi, sqlite3, adodb libraries
Conan




RedWaratah.com
Open Source Solutions for Business
Nagios
●
    I spoke three years ago about Python for
    writing Nagios plugins
●
    Our Nagios server got virtualised two years
    ago
●
    We have a Ubuntu desktop PC showing the
    Nagios and RateFeed status
●
    Sounds an alarm when new errors emerge

     RedWaratah.com
     Open Source Solutions for Business
Nagios




RedWaratah.com
Open Source Solutions for Business
                                              Using numerous libraries
Tkinter
●
    I love it
●
    Not sexy or super responsive, but fast to code
    and reliable
●
    Six different Tkinter applications




      RedWaratah.com
      Open Source Solutions for Business
                                               Using tkinter, tkmessagebox, tkdialog libraries
Tkinter – example 1




RedWaratah.com
Open Source Solutions for Business
Tkinter – example 2




RedWaratah.com
Open Source Solutions for Business
Tkinter – example 3




RedWaratah.com
Open Source Solutions for Business
Tkinter – example 4




RedWaratah.com
Open Source Solutions for Business
Tkinter – example 5




RedWaratah.com
Open Source Solutions for Business
RateFeed
●
    Three Tkinter based applications written in Python
●
    Download rates from Reuters via FTP
●
    Calculate curves from a detailed INI file
●
    Keep results and logs in two SQLite files
●
    Write to two servers via DCOM
●
    Respond to queries via RPC



     RedWaratah.com
     Open Source Solutions for Business
RateFeed




RedWaratah.com
Open Source Solutions for Business
                                            Using numerous libraries
RateFeed Export
●
    Managers cannot understand our RateFeed
●
    Python generates two exports a day in Excel
    –    Import openpyxl
●
    Tabs for different curve types
●
    Columns for incoming data, formulae and
    outgoing data
●
    Used to get sign off on curve changes

        RedWaratah.com
        Open Source Solutions for Business
RateFeed Export




RedWaratah.com
Open Source Solutions for Business
                                     Using openpyxl, sqlite3 libraries
Firewall settings
●
    We open our firewall to registered customers only
●
    Their IP addresses change as they change ISP, proxy
    settings, location etc.
●
    Checking IP addresses quite error prone.
●
    Now after each change, we export our firewall configuration
    to a set location
●
    On change, Python updates our wiki with current client data




      RedWaratah.com
      Open Source Solutions for Business
Firewall settings




RedWaratah.com
Open Source Solutions for Business
                                           Using re, smtplib libraries
Crystal Report Management
●
    We have 300 Crystal Reports
●
    Our test server databases have different names to production,
    but Crystal Reports requires each table to be reset to use a
    different database
●
    Python shifts changes in the production version and the test
    version by using the Crystal API to fix every table
●
    All via accessing the DCOM interface into Crystal Reports




       RedWaratah.com
       Open Source Solutions for Business
Crystal Reports Management




RedWaratah.com
Open Source Solutions for Business
                                     Using win32com.client library (pywin32)
Change Request Management
●
    Change requests go into our defect management system
●
    When assessed and approved, the go into the work list.
●
    Python picks up newly assessed work and adds it to the
    end of Planner XML files for project management
●
    Email reports show projections on updates to these plans




      RedWaratah.com
      Open Source Solutions for Business
Change Request Management




RedWaratah.com
Open Source Solutions for Business
                                     Using sax, adodb libraries
Crystal Report Testing
●
    Crystal Reports used for confirmation of trading
●
    These reports have loads of business logic
●
    If we need to make a change, what is the impact
●
    Python re runs every such confirmation for last
    12 months under the new and old template,
    exports to Excel and flags any differences
●
    Tkinter GUI shows progress

     RedWaratah.com
     Open Source Solutions for Business
Crystal Report Testing
                                        ●
                                            Grabs parameters from
                                            past confos
                                        ●
                                            Applies them to the new
                                            and old template
                                        ●
                                            Exports to HTML and
                                            compare
                                        ●
                                            Note differences and
                                            store


RedWaratah.com
Open Source Solutions for Business
                                     Using adodb, html, win32com.client, tkinter libraries
Risk scenario building
●
    Have special Risk reports that model the impact of
    different current shifts
●
    28 currencies x 11 scenarios x 15 points per currency
●
    GUI is slow, errors high
●
    GUI exports to XML and imports
●
    Python generates XML with all required scenarios built
    from an INI file
●
    Tkinter interface


      RedWaratah.com
      Open Source Solutions for Business
Risk scenario building
Given this...




   RedWaratah.com
   Open Source Solutions for Business
Risk scenario building
...builds this:




    RedWaratah.com
    Open Source Solutions for Business
                                         Using sax, win32com.client, tkinter libraries
Backup tool
●
    Test servers are not backed up
●
    Python scheduled task puts contents of key
    folder and anything linked to it into a ZIP file
    and puts this on the main file server
●
    Follows file links




     RedWaratah.com
     Open Source Solutions for Business
Backup tool




RedWaratah.com
Open Source Solutions for Business
                                       Using os, win32com.client, zip libraries
Disaster Recovery
●
    Much of our DRP is in soft copy
●
    The detail is in a Media Wiki database and
    TestTrack database
●
    Python exports all MediaWiki articles and
    TestTrack items into HTML
●
    These are burned to DVDs quarterly along
    with ZIPs from the backup tool

     RedWaratah.com
     Open Source Solutions for Business
Disaster Recovery




RedWaratah.com
Open Source Solutions for Business
                                     Using subprocess, urllib libraries
RESTful Interface
●
    I wrote a dashboard using the Underscore
    backbone (in JavaScript). It wanted to interact
    via Restful interface
●
    I created such an interface as a Python CGI
    with the Apache rewriting




     RedWaratah.com
     Open Source Solutions for Business
RESTful Interface




RedWaratah.com
Open Source Solutions for Business
                                     Using cgi, sqlite3, xmlrpc libraries
RESTful Interface




RedWaratah.com
Open Source Solutions for Business
ImageMagick Scripting
●
    I have a Python script running unsupervised
    on the server
●
    It responds to RPC requests
●
    Python drives ImageMagick to build a visual
    representation
●
    Also, did a target for a competition



     RedWaratah.com
     Open Source Solutions for Business
ImageMagick Scripting




RedWaratah.com
Open Source Solutions for Business
                                     Using subprocess, os libraries
ImageMagick Scripting




RedWaratah.com
Open Source Solutions for Business
Test Server Symbol Management
●
    Each server has different resource locations
    –    Server name is in the UNC
●
    These are in an INI file
●
    Python library to access this INI file
●
    Caches the results in a pickle file to reduce
    network traffic and improve resiliency



        RedWaratah.com
        Open Source Solutions for Business
Test Server Symbol Management




 RedWaratah.com
 Open Source Solutions for Business
Rate Checker
●
    Many rates go in each day at different times
●
    Required to confirm the success of rates
●
    Python compares today's rates with yesterday,
    a week ago and last month end
●
    Reports via email
●
    Emails are logged as proof of our diligence


     RedWaratah.com
     Open Source Solutions for Business
Rate Checker




RedWaratah.com
Open Source Solutions for Business
                                     Using smtplib, adodb, configparser libraries
Rate Checker




RedWaratah.com
Open Source Solutions for Business
Special Thanks to...
●
    Guido Van Rossum – keeping it simple and powerful
●
    Mark Hammond – Making it work on Windows
●
    Libaries
    –   Tkinter for easy UI
    –   Openpyxl for Excel import and export
    –   email and smtplib for sending email
    –   Urllib and httplib for capture and parsing
    –   Re for regular expressions
    –   argparse, configparser and winreg for parameterisation
    –   Subprocess for process management
●
    And the Python community for sample code all over the internet

        RedWaratah.com
        Open Source Solutions for Business
Go forth and code!




RedWaratah.com
Open Source Solutions for Business

More Related Content

Viewers also liked

Learn 90% of Python in 90 Minutes
Learn 90% of Python in 90 MinutesLearn 90% of Python in 90 Minutes
Learn 90% of Python in 90 MinutesMatt Harrison
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to PythonNowell Strite
 
Creating masterpieces with raphael
Creating masterpieces with raphaelCreating masterpieces with raphael
Creating masterpieces with raphaelPippi Labradoodle
 
Tkinter Does Not Suck
Tkinter Does Not SuckTkinter Does Not Suck
Tkinter Does Not SuckRichard Jones
 
Python Programming - XIII. GUI Programming
Python Programming - XIII. GUI ProgrammingPython Programming - XIII. GUI Programming
Python Programming - XIII. GUI ProgrammingRanel Padon
 
29c3 OpenBTS workshop - Mini-Workshop
29c3 OpenBTS workshop - Mini-Workshop29c3 OpenBTS workshop - Mini-Workshop
29c3 OpenBTS workshop - Mini-WorkshopAlexander Chemeris
 
Don Bailey - A Million Little Tracking Devices
Don Bailey  - A Million Little Tracking DevicesDon Bailey  - A Million Little Tracking Devices
Don Bailey - A Million Little Tracking DevicesSource Conference
 
How To Automate Part 1
How To Automate Part 1How To Automate Part 1
How To Automate Part 1Sean Durocher
 
DAB+ for local and community radio
DAB+ for local and community radioDAB+ for local and community radio
DAB+ for local and community radioradioradioradio
 
Computação Visual com Python
Computação Visual com PythonComputação Visual com Python
Computação Visual com PythonJonh Edson
 
Python高级编程(二)
Python高级编程(二)Python高级编程(二)
Python高级编程(二)Qiangning Hong
 
Creating Excel files with Python and XlsxWriter
Creating Excel files with Python and XlsxWriterCreating Excel files with Python and XlsxWriter
Creating Excel files with Python and XlsxWriterjmncnamara
 
Python在豆瓣的应用
Python在豆瓣的应用Python在豆瓣的应用
Python在豆瓣的应用Qiangning Hong
 
Introdução a python módulo c
Introdução a python   módulo cIntrodução a python   módulo c
Introdução a python módulo cJader Gabriel
 
Manual clips
Manual clipsManual clips
Manual clipsworkhome
 
The Synergy of Drupal Hooks/APIs (Custom Module Development with ChartJS)
The Synergy of Drupal Hooks/APIs (Custom Module Development with ChartJS)The Synergy of Drupal Hooks/APIs (Custom Module Development with ChartJS)
The Synergy of Drupal Hooks/APIs (Custom Module Development with ChartJS)Ranel Padon
 
デザイナーがTkinterで遊んでみました。
デザイナーがTkinterで遊んでみました。デザイナーがTkinterで遊んでみました。
デザイナーがTkinterで遊んでみました。Chachamaru
 

Viewers also liked (20)

Learn 90% of Python in 90 Minutes
Learn 90% of Python in 90 MinutesLearn 90% of Python in 90 Minutes
Learn 90% of Python in 90 Minutes
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
Creating masterpieces with raphael
Creating masterpieces with raphaelCreating masterpieces with raphael
Creating masterpieces with raphael
 
Py S60
Py S60Py S60
Py S60
 
An introduction-to-tkinter
An introduction-to-tkinterAn introduction-to-tkinter
An introduction-to-tkinter
 
Tkinter Does Not Suck
Tkinter Does Not SuckTkinter Does Not Suck
Tkinter Does Not Suck
 
Python Programming - XIII. GUI Programming
Python Programming - XIII. GUI ProgrammingPython Programming - XIII. GUI Programming
Python Programming - XIII. GUI Programming
 
29c3 OpenBTS workshop - Mini-Workshop
29c3 OpenBTS workshop - Mini-Workshop29c3 OpenBTS workshop - Mini-Workshop
29c3 OpenBTS workshop - Mini-Workshop
 
Don Bailey - A Million Little Tracking Devices
Don Bailey  - A Million Little Tracking DevicesDon Bailey  - A Million Little Tracking Devices
Don Bailey - A Million Little Tracking Devices
 
How To Automate Part 1
How To Automate Part 1How To Automate Part 1
How To Automate Part 1
 
DAB+ for local and community radio
DAB+ for local and community radioDAB+ for local and community radio
DAB+ for local and community radio
 
Computação Visual com Python
Computação Visual com PythonComputação Visual com Python
Computação Visual com Python
 
Python高级编程(二)
Python高级编程(二)Python高级编程(二)
Python高级编程(二)
 
Creating Excel files with Python and XlsxWriter
Creating Excel files with Python and XlsxWriterCreating Excel files with Python and XlsxWriter
Creating Excel files with Python and XlsxWriter
 
Python在豆瓣的应用
Python在豆瓣的应用Python在豆瓣的应用
Python在豆瓣的应用
 
Introdução a python módulo c
Introdução a python   módulo cIntrodução a python   módulo c
Introdução a python módulo c
 
Manual clips
Manual clipsManual clips
Manual clips
 
The Synergy of Drupal Hooks/APIs (Custom Module Development with ChartJS)
The Synergy of Drupal Hooks/APIs (Custom Module Development with ChartJS)The Synergy of Drupal Hooks/APIs (Custom Module Development with ChartJS)
The Synergy of Drupal Hooks/APIs (Custom Module Development with ChartJS)
 
デザイナーがTkinterで遊んでみました。
デザイナーがTkinterで遊んでみました。デザイナーがTkinterで遊んでみました。
デザイナーがTkinterで遊んでみました。
 
Import python
Import pythonImport python
Import python
 

Similar to 20 cool things python

Primavera gateway SAP provider - Oracle Primavera P6 Collaborate 14
Primavera gateway SAP provider - Oracle Primavera P6 Collaborate 14Primavera gateway SAP provider - Oracle Primavera P6 Collaborate 14
Primavera gateway SAP provider - Oracle Primavera P6 Collaborate 14p6academy
 
PAD-3126 - Evolving the DevOps Organization around IBM PureApplication System...
PAD-3126 - Evolving the DevOps Organization around IBM PureApplication System...PAD-3126 - Evolving the DevOps Organization around IBM PureApplication System...
PAD-3126 - Evolving the DevOps Organization around IBM PureApplication System...Hendrik van Run
 
Business Intelligence Open Source
Business Intelligence Open SourceBusiness Intelligence Open Source
Business Intelligence Open SourceRoberto Marchetto
 
Advanced technologies and techniques for debugging HPC applications
Advanced technologies and techniques for debugging HPC applicationsAdvanced technologies and techniques for debugging HPC applications
Advanced technologies and techniques for debugging HPC applicationsRogue Wave Software
 
An overview of data and web-application development with Python
An overview of data and web-application development with PythonAn overview of data and web-application development with Python
An overview of data and web-application development with PythonSivaranjan Goswami
 
Leveraging open source for large scale analytics
Leveraging open source for large scale analyticsLeveraging open source for large scale analytics
Leveraging open source for large scale analyticsSouth West Data Meetup
 
Presto – Today and Beyond – The Open Source SQL Engine for Querying all Data...
Presto – Today and Beyond – The Open Source SQL Engine for Querying all Data...Presto – Today and Beyond – The Open Source SQL Engine for Querying all Data...
Presto – Today and Beyond – The Open Source SQL Engine for Querying all Data...Dipti Borkar
 
H2o.ai presentation at 2nd Virtual Pydata Piraeus meetup
H2o.ai presentation at 2nd Virtual Pydata Piraeus meetupH2o.ai presentation at 2nd Virtual Pydata Piraeus meetup
H2o.ai presentation at 2nd Virtual Pydata Piraeus meetupPyData Piraeus
 
Diff between win runner vs and qtp
Diff between win runner vs and qtpDiff between win runner vs and qtp
Diff between win runner vs and qtpRamu Palanki
 
OSMC 2012 | Zabbix 2.0: Even Better by Rihards Olups
OSMC 2012 | Zabbix 2.0: Even Better by Rihards OlupsOSMC 2012 | Zabbix 2.0: Even Better by Rihards Olups
OSMC 2012 | Zabbix 2.0: Even Better by Rihards OlupsNETWAYS
 
Talend Open Studio Data Integration
Talend Open Studio Data IntegrationTalend Open Studio Data Integration
Talend Open Studio Data IntegrationRoberto Marchetto
 
RedisConf17 - Dynomite - Making Non-distributed Databases Distributed
RedisConf17 - Dynomite - Making Non-distributed Databases DistributedRedisConf17 - Dynomite - Making Non-distributed Databases Distributed
RedisConf17 - Dynomite - Making Non-distributed Databases DistributedRedis Labs
 
An EyeWitness View into your Network
An EyeWitness View into your NetworkAn EyeWitness View into your Network
An EyeWitness View into your NetworkCTruncer
 
Slides PAPIs.io'14 RapidMiner
Slides PAPIs.io'14 RapidMinerSlides PAPIs.io'14 RapidMiner
Slides PAPIs.io'14 RapidMinerSabrina Kirstein
 
Sabrina Kirstein @ RapidMiner
Sabrina Kirstein @ RapidMinerSabrina Kirstein @ RapidMiner
Sabrina Kirstein @ RapidMinerPAPIs.io
 
A compute infrastructure for data scientists
A compute infrastructure for data scientistsA compute infrastructure for data scientists
A compute infrastructure for data scientistsStitch Fix Algorithms
 
Stream processing with Apache Flink @ OfferUp
Stream processing with Apache Flink @ OfferUpStream processing with Apache Flink @ OfferUp
Stream processing with Apache Flink @ OfferUpBowen Li
 
Pivotal Real Time Data Stream Analytics
Pivotal Real Time Data Stream AnalyticsPivotal Real Time Data Stream Analytics
Pivotal Real Time Data Stream Analyticskgshukla
 
Google BigQuery for Everyday Developer
Google BigQuery for Everyday DeveloperGoogle BigQuery for Everyday Developer
Google BigQuery for Everyday DeveloperMárton Kodok
 

Similar to 20 cool things python (20)

Primavera gateway SAP provider - Oracle Primavera P6 Collaborate 14
Primavera gateway SAP provider - Oracle Primavera P6 Collaborate 14Primavera gateway SAP provider - Oracle Primavera P6 Collaborate 14
Primavera gateway SAP provider - Oracle Primavera P6 Collaborate 14
 
PAD-3126 - Evolving the DevOps Organization around IBM PureApplication System...
PAD-3126 - Evolving the DevOps Organization around IBM PureApplication System...PAD-3126 - Evolving the DevOps Organization around IBM PureApplication System...
PAD-3126 - Evolving the DevOps Organization around IBM PureApplication System...
 
Business Intelligence Open Source
Business Intelligence Open SourceBusiness Intelligence Open Source
Business Intelligence Open Source
 
Advanced technologies and techniques for debugging HPC applications
Advanced technologies and techniques for debugging HPC applicationsAdvanced technologies and techniques for debugging HPC applications
Advanced technologies and techniques for debugging HPC applications
 
An overview of data and web-application development with Python
An overview of data and web-application development with PythonAn overview of data and web-application development with Python
An overview of data and web-application development with Python
 
Leveraging open source for large scale analytics
Leveraging open source for large scale analyticsLeveraging open source for large scale analytics
Leveraging open source for large scale analytics
 
Presto – Today and Beyond – The Open Source SQL Engine for Querying all Data...
Presto – Today and Beyond – The Open Source SQL Engine for Querying all Data...Presto – Today and Beyond – The Open Source SQL Engine for Querying all Data...
Presto – Today and Beyond – The Open Source SQL Engine for Querying all Data...
 
H2o.ai presentation at 2nd Virtual Pydata Piraeus meetup
H2o.ai presentation at 2nd Virtual Pydata Piraeus meetupH2o.ai presentation at 2nd Virtual Pydata Piraeus meetup
H2o.ai presentation at 2nd Virtual Pydata Piraeus meetup
 
Diff between win runner vs and qtp
Diff between win runner vs and qtpDiff between win runner vs and qtp
Diff between win runner vs and qtp
 
OSMC 2012 | Zabbix 2.0: Even Better by Rihards Olups
OSMC 2012 | Zabbix 2.0: Even Better by Rihards OlupsOSMC 2012 | Zabbix 2.0: Even Better by Rihards Olups
OSMC 2012 | Zabbix 2.0: Even Better by Rihards Olups
 
Talend Open Studio Data Integration
Talend Open Studio Data IntegrationTalend Open Studio Data Integration
Talend Open Studio Data Integration
 
RedisConf17 - Dynomite - Making Non-distributed Databases Distributed
RedisConf17 - Dynomite - Making Non-distributed Databases DistributedRedisConf17 - Dynomite - Making Non-distributed Databases Distributed
RedisConf17 - Dynomite - Making Non-distributed Databases Distributed
 
An EyeWitness View into your Network
An EyeWitness View into your NetworkAn EyeWitness View into your Network
An EyeWitness View into your Network
 
Slides PAPIs.io'14 RapidMiner
Slides PAPIs.io'14 RapidMinerSlides PAPIs.io'14 RapidMiner
Slides PAPIs.io'14 RapidMiner
 
Dynomite @ RedisConf 2017
Dynomite @ RedisConf 2017Dynomite @ RedisConf 2017
Dynomite @ RedisConf 2017
 
Sabrina Kirstein @ RapidMiner
Sabrina Kirstein @ RapidMinerSabrina Kirstein @ RapidMiner
Sabrina Kirstein @ RapidMiner
 
A compute infrastructure for data scientists
A compute infrastructure for data scientistsA compute infrastructure for data scientists
A compute infrastructure for data scientists
 
Stream processing with Apache Flink @ OfferUp
Stream processing with Apache Flink @ OfferUpStream processing with Apache Flink @ OfferUp
Stream processing with Apache Flink @ OfferUp
 
Pivotal Real Time Data Stream Analytics
Pivotal Real Time Data Stream AnalyticsPivotal Real Time Data Stream Analytics
Pivotal Real Time Data Stream Analytics
 
Google BigQuery for Everyday Developer
Google BigQuery for Everyday DeveloperGoogle BigQuery for Everyday Developer
Google BigQuery for Everyday Developer
 

Recently uploaded

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 

Recently uploaded (20)

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 

20 cool things python

  • 1. 20 Cool Things I have done in Python Maurice Maneschi RedWaratah.com RedWaratah.com Open Source Solutions for Business
  • 2. Who am I ● I am a former mainframe developer ● I work for Financial Advisory company ● All Microsoft and Excel ● However, Python gives me a tool kit that easily solves dvierse, apparently intractable data and integration problems ● I am a hero for the problems I can solve RedWaratah.com Open Source Solutions for Business
  • 3. Format ● I will fly through 20 examples of what I have done ● Slow me down for the interesting slides, speed me up for the boring ones ● For details, grab me afterwards over coffee ● See the key libraries on the bottom right – Search the web for samples – Send me email anything@redwaratah.com RedWaratah.com Open Source Solutions for Business
  • 4. Configuration ● Python header ● Command line ● INI file ● Windows Registry RedWaratah.com Open Source Solutions for Business
  • 5. Configuration – in the header RedWaratah.com Open Source Solutions for Business
  • 6. Configuration – command line RedWaratah.com Open Source Solutions for Business Using argparse library
  • 7. Configuration – ini file RedWaratah.com Open Source Solutions for Business Using configparser library
  • 8. Configuration – Windows registry RedWaratah.com Open Source Solutions for Business Using winreg library
  • 9. Using DLLs ● I had to debug a Windows program in production without a debugger ● Using Python ctypes, I called each subroutine until I discovered the defect RedWaratah.com Open Source Solutions for Business
  • 10. Using DLLs RedWaratah.com Open Source Solutions for Business Using ctypes library
  • 11. Driving a website ● Single window website for MSIE only ● Running reports is fiddly, same report routinely is painful ● Python proxy server to log the responses ● I built an application that mimicked the browser and download the reports in PDF and Excel RedWaratah.com Open Source Solutions for Business
  • 12. Driving a web site – part 1 RedWaratah.com Open Source Solutions for Business Using urllib, html, http and re libraries
  • 13. Driving a web site – part 2 RedWaratah.com Open Source Solutions for Business
  • 14. Regular Expression Log Parsing ● MS IIS logs are nightly copied to a folder ● Python uses RE to capture log ons and report runs ● Converts IP address to client name via firewall config ● Saves the data to an SQLite database ● This data is provided regularly to the wiki article on active clients RedWaratah.com Open Source Solutions for Business
  • 15. Regular Expression Log Parsing RedWaratah.com Open Source Solutions for Business Using re, sqlite3 libraries
  • 16. Regular Expression Magic ● We have the Mediawiki (Wikipedia) for documentation and TestTrack for defect tracking ● Python does a nightly read of the wiki articles and builds a huge regular expression (3 actually) of all titles ● Python does a nightly extract of the contents of TestTrack to HTML and hyper links any reference to the articles back to the wiki RedWaratah.com Open Source Solutions for Business
  • 17. Regular Expression Magic - pt1 RedWaratah.com Open Source Solutions for Business Using re, subprocess libraries
  • 18. Regular Expression Magic – pt 2 RedWaratah.com Open Source Solutions for Business
  • 19. Scheduled Task Status ● We have about 30 scheduled tasks that run each day (or more frequently) ● Python scans the status return codes every 5 minutes and puts the results into a CSV files ● MSDN defines the format of the job files and Python can read these formats ● Nagios warns if any status codes are not 0 RedWaratah.com Open Source Solutions for Business
  • 20. Scheduled Task Status RedWaratah.com Open Source Solutions for Business Using struct, csv libraries
  • 21. Scheduled Task Status RedWaratah.com Open Source Solutions for Business
  • 22. Static Data Checker ● Our key software tool does not audit every Static Data table ● Changes can happen inadvertently ● Python reads every nominated table, pickles each row and pops the results into an SQLite table ● Daily report of new, changed or deleted rows RedWaratah.com Open Source Solutions for Business
  • 23. Static Data Checker Row Static data Pickle Key Value SQlite RedWaratah.com Open Source Solutions for Business Using adodb, pickle, sqlite3 libraries
  • 24. Static Data Checker RedWaratah.com Open Source Solutions for Business
  • 25. Static Data Checker RedWaratah.com Open Source Solutions for Business
  • 26. Conan: Flagging required email ● Purchased Software is meant to send email confirming financial transactions that we track ● It fails to correctly ascertain settlements ● Python creates a web site that shows which settlements have to be sent ● Annotations ● Validates against the transmission logs RedWaratah.com Open Source Solutions for Business
  • 27. Conan RedWaratah.com Open Source Solutions for Business Using html, cgi, sqlite3, adodb libraries
  • 29. Nagios ● I spoke three years ago about Python for writing Nagios plugins ● Our Nagios server got virtualised two years ago ● We have a Ubuntu desktop PC showing the Nagios and RateFeed status ● Sounds an alarm when new errors emerge RedWaratah.com Open Source Solutions for Business
  • 30. Nagios RedWaratah.com Open Source Solutions for Business Using numerous libraries
  • 31. Tkinter ● I love it ● Not sexy or super responsive, but fast to code and reliable ● Six different Tkinter applications RedWaratah.com Open Source Solutions for Business Using tkinter, tkmessagebox, tkdialog libraries
  • 32. Tkinter – example 1 RedWaratah.com Open Source Solutions for Business
  • 33. Tkinter – example 2 RedWaratah.com Open Source Solutions for Business
  • 34. Tkinter – example 3 RedWaratah.com Open Source Solutions for Business
  • 35. Tkinter – example 4 RedWaratah.com Open Source Solutions for Business
  • 36. Tkinter – example 5 RedWaratah.com Open Source Solutions for Business
  • 37. RateFeed ● Three Tkinter based applications written in Python ● Download rates from Reuters via FTP ● Calculate curves from a detailed INI file ● Keep results and logs in two SQLite files ● Write to two servers via DCOM ● Respond to queries via RPC RedWaratah.com Open Source Solutions for Business
  • 38. RateFeed RedWaratah.com Open Source Solutions for Business Using numerous libraries
  • 39. RateFeed Export ● Managers cannot understand our RateFeed ● Python generates two exports a day in Excel – Import openpyxl ● Tabs for different curve types ● Columns for incoming data, formulae and outgoing data ● Used to get sign off on curve changes RedWaratah.com Open Source Solutions for Business
  • 40. RateFeed Export RedWaratah.com Open Source Solutions for Business Using openpyxl, sqlite3 libraries
  • 41. Firewall settings ● We open our firewall to registered customers only ● Their IP addresses change as they change ISP, proxy settings, location etc. ● Checking IP addresses quite error prone. ● Now after each change, we export our firewall configuration to a set location ● On change, Python updates our wiki with current client data RedWaratah.com Open Source Solutions for Business
  • 42. Firewall settings RedWaratah.com Open Source Solutions for Business Using re, smtplib libraries
  • 43. Crystal Report Management ● We have 300 Crystal Reports ● Our test server databases have different names to production, but Crystal Reports requires each table to be reset to use a different database ● Python shifts changes in the production version and the test version by using the Crystal API to fix every table ● All via accessing the DCOM interface into Crystal Reports RedWaratah.com Open Source Solutions for Business
  • 44. Crystal Reports Management RedWaratah.com Open Source Solutions for Business Using win32com.client library (pywin32)
  • 45. Change Request Management ● Change requests go into our defect management system ● When assessed and approved, the go into the work list. ● Python picks up newly assessed work and adds it to the end of Planner XML files for project management ● Email reports show projections on updates to these plans RedWaratah.com Open Source Solutions for Business
  • 46. Change Request Management RedWaratah.com Open Source Solutions for Business Using sax, adodb libraries
  • 47. Crystal Report Testing ● Crystal Reports used for confirmation of trading ● These reports have loads of business logic ● If we need to make a change, what is the impact ● Python re runs every such confirmation for last 12 months under the new and old template, exports to Excel and flags any differences ● Tkinter GUI shows progress RedWaratah.com Open Source Solutions for Business
  • 48. Crystal Report Testing ● Grabs parameters from past confos ● Applies them to the new and old template ● Exports to HTML and compare ● Note differences and store RedWaratah.com Open Source Solutions for Business Using adodb, html, win32com.client, tkinter libraries
  • 49. Risk scenario building ● Have special Risk reports that model the impact of different current shifts ● 28 currencies x 11 scenarios x 15 points per currency ● GUI is slow, errors high ● GUI exports to XML and imports ● Python generates XML with all required scenarios built from an INI file ● Tkinter interface RedWaratah.com Open Source Solutions for Business
  • 50. Risk scenario building Given this... RedWaratah.com Open Source Solutions for Business
  • 51. Risk scenario building ...builds this: RedWaratah.com Open Source Solutions for Business Using sax, win32com.client, tkinter libraries
  • 52. Backup tool ● Test servers are not backed up ● Python scheduled task puts contents of key folder and anything linked to it into a ZIP file and puts this on the main file server ● Follows file links RedWaratah.com Open Source Solutions for Business
  • 53. Backup tool RedWaratah.com Open Source Solutions for Business Using os, win32com.client, zip libraries
  • 54. Disaster Recovery ● Much of our DRP is in soft copy ● The detail is in a Media Wiki database and TestTrack database ● Python exports all MediaWiki articles and TestTrack items into HTML ● These are burned to DVDs quarterly along with ZIPs from the backup tool RedWaratah.com Open Source Solutions for Business
  • 55. Disaster Recovery RedWaratah.com Open Source Solutions for Business Using subprocess, urllib libraries
  • 56. RESTful Interface ● I wrote a dashboard using the Underscore backbone (in JavaScript). It wanted to interact via Restful interface ● I created such an interface as a Python CGI with the Apache rewriting RedWaratah.com Open Source Solutions for Business
  • 57. RESTful Interface RedWaratah.com Open Source Solutions for Business Using cgi, sqlite3, xmlrpc libraries
  • 59. ImageMagick Scripting ● I have a Python script running unsupervised on the server ● It responds to RPC requests ● Python drives ImageMagick to build a visual representation ● Also, did a target for a competition RedWaratah.com Open Source Solutions for Business
  • 60. ImageMagick Scripting RedWaratah.com Open Source Solutions for Business Using subprocess, os libraries
  • 62. Test Server Symbol Management ● Each server has different resource locations – Server name is in the UNC ● These are in an INI file ● Python library to access this INI file ● Caches the results in a pickle file to reduce network traffic and improve resiliency RedWaratah.com Open Source Solutions for Business
  • 63. Test Server Symbol Management RedWaratah.com Open Source Solutions for Business
  • 64. Rate Checker ● Many rates go in each day at different times ● Required to confirm the success of rates ● Python compares today's rates with yesterday, a week ago and last month end ● Reports via email ● Emails are logged as proof of our diligence RedWaratah.com Open Source Solutions for Business
  • 65. Rate Checker RedWaratah.com Open Source Solutions for Business Using smtplib, adodb, configparser libraries
  • 66. Rate Checker RedWaratah.com Open Source Solutions for Business
  • 67. Special Thanks to... ● Guido Van Rossum – keeping it simple and powerful ● Mark Hammond – Making it work on Windows ● Libaries – Tkinter for easy UI – Openpyxl for Excel import and export – email and smtplib for sending email – Urllib and httplib for capture and parsing – Re for regular expressions – argparse, configparser and winreg for parameterisation – Subprocess for process management ● And the Python community for sample code all over the internet RedWaratah.com Open Source Solutions for Business
  • 68. Go forth and code! RedWaratah.com Open Source Solutions for Business