This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scalaj.http._ | |
case class httpResponse(code: Int, body: String, url: String) | |
object httpRequest { | |
val options = Map( | |
"connTimeout" -> 5000, | |
"readTimeout" -> 5000 | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
An array of services that you want to integrate. I didnt make it an object because these services are started and stopped in the order they appear in the array. | |
Here i have taken 3 examples- kissmetrcs, intercom and vero | |
Service properties: | |
enabled- Setting it to false doesnt start or track events for this service | |
start- This function is initialises the servcie. In this function i place the initialization code snipplet that the service provides me. | |
Takes an optional array which has the service names i want to start. If this parameter is ommited all services are started | |
stop- Some services like intercom have a shutdown function, so here goes that code | |
track- This is the tracking function that is used to track events with the service. Takes 2 parameters eventName and eventData | |
validate: Sometimes you dont want to send tracking for some accounts, maybe they are test accounts or you are logging into some account as admin. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import simplejson as json | |
import os | |
class GCMMultiRequest(object): | |
def __init__(self, gcm_url, headers): | |
self.gcm_url = gcm_url | |
self.headers = headers | |
self.session = requests.Session() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import MySQLdb | |
import MySQLdb.cursors | |
from config import config | |
class Cursor(object): | |
def __init__(self, mysql_cursor): | |
self.cursor = mysql_cursor | |
def __iter__(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Here models are in different modules and the models.py imports them from different modules like this | |
from model1 import * # or the name of models you want to import | |
from model2 import User | |
or you might write all your models in models.py | |
""" | |
NewerOlder