Skip to content

snkinard/python-intro-app

Repository files navigation

Build Status

Overview

MsgParser is a simple python package that can build json metadata about a chat message.

Example

I am @sam and here is a link: https://www.simple.com have a nice day (smiley).
{
  "raw": "I am @sam and here is a link: https://www.simple.com have a nice day (smiley).", 
  "emoticons": ["smiley"], 
  "links": [{
    "url": "https://www.simple.com", 
    "title": "Simple | Online Banking With Automatic Budgeting & Savings"
  }],     
  "mentions": ["sam"]
}

Setup and Usage

This software was developed in OS X 10.11.3 with Python 2.7.10.

OS X Development Environment Setup

This guide assumes that you have pulled the source code down onto your local machine.

Add the code directory to your python path

$ export PYTHONPATH=$PYTHONPATH:/path/to/code/directory

Install dependencies pytest and mechanize using easy_install

$ easy_install -U pytest
$ easy_install -U mechanize

Running the tests

To run the tests locally simply run pytest in the code directory

$ py.test

Continuous Integration is hosted in drone.io

Usage

It's easy to try out MsgParser in the python console:

$ cd /path/to/code/directory
$ python
Python 2.7.10 (default, Oct 23 2015, 18:05:06)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from msg_parser import MsgParser
>>> parse = MsgParser()
>>> parse.parse_message("Hello, @sam!")
>>> parse.to_json_str()
'{"raw": "Hello, @sam!", "emoticons": [], "links": [], "mentions": ["sam"]}'

See test_msg_parser.py for more interesting examples.

About

I created this small app to check out Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages