Skip to content

Instantly share code, notes, and snippets.

View joefusaro's full-sized avatar

Joe Fusaro joefusaro

View GitHub Profile
from marketorestpython.client import MarketoClient
BATCH_ID = 3274
MUNCHKIN_ID = 'xxx-xxx-xxx'
CLIENT_ID = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
CLIENT_SECRET = 'xxxxxxxxxxxxxx'
mc = MarketoClient(MUNCHKIN_ID, CLIENT_ID, CLIENT_SECRET)
failed_leads = mc.execute(method='get_import_failure_file', id=BATCH_ID)
file_name = "import-failure-for-batch-" + str(BATCH_ID) + ".csv"
@joefusaro
joefusaro / gist:3e3b48cc9607e6526977d638ffb49d35
Created January 8, 2019 01:52
backup - previous button style
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tbody align="center">
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td align="center" bgcolor="#1273fa"><a href="{{my.pro_pilot_landing_page}}" target="_blank" style="font-size: 14px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; border-radius: 3px; padding: 12px 18px; display: inline-block;">Let's launch your pilot</a></td>
</tr>
</tbody>
from utils import SalesforceUtility
username = 'joe.fusaro@ivanti.com'
password = 'myPassword'
token = 'mySecurityToken'
if __name__ == "__main__":
sfdc = SalesforceUtility(username, password, token)
client = sfdc.connection
AFGHANISTAN
ALBANIA
ALGERIA
AMERICAN SAMOA
ANDORRA
ANGOLA
ANGUILLA
ANTARCTICA
ANTIGUA AND BARBUDA
ARGENTINA
<HTMLQuestion xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2011-11-11/HTMLQuestion.xsd">
<HTMLContent><![CDATA[
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
<script type='text/javascript' src='https://s3.amazonaws.com/mturk-public/externalHIT_v1.js'></script>
</head>
<body>
<form name='mturk_form' method='post' id='mturk_form' action='https://www.mturk.com/mturk/externalSubmit'>
import requests
from integrations.utils import convert_str
from integrations.salesforce.soap import SalesforceMergeManager
from integrations.salesforce.settings import SALESFORCE_FIELDS_TO_IGNORE
record_type_mapper = {
'SALESFORCE':SalesforceMergeManager
}
field_names_to_ignore = {
import React from 'react';
class ChangeList extends React.Component {
constructor() {
super();
this.state={items:[]};
}
componentDidMount(){
fetch(`http://127.0.0.1:8000/backup/changes/1/Lead.json`)
""" Certain methods are not available via REST API, so we have to recreate!"""
import requests
from lxml.etree import Element, SubElement, tostring
class LeadConverter(object):
def __init__(self, session_id, lead_id, **kwargs):
""" Provides functionality for converting a Lead to a new or existing
Account and create a new Contact or update an existing Contact.
In [30]: my_dataset.add_samples(
[
('create a lead [[ person ]], [[ company ]], [[ date ]]', 'create_lead'),
('create a new lead [[ person ]], [[ agent ]], [[ date ]]', 'create_lead')], input_type="text")
Starting data upload...
Traceback (most recent call last):
File "/Users/joefusaro/perry/venv/lib/python2.7/site-packages/metamind/api/utils.py", line 33, in make_request
return validate_result(response)
File "/Users/joefusaro/perry/venv/lib/python2.7/site-packages/metamind/api/utils.py", line 131, in validate_result
raise ValueError(result["message"])
@joefusaro
joefusaro / utils.py
Last active April 2, 2016 04:12
Take a text string and a list of dictionary objects; replaces each value in a string with the corresponding key.
class TextLabeler():
"""Takes a text string and a list of dictionary objects; replaces each
occurence of a value in a string with the corresponding key. For example:
>>> string = "Let's take a trip to Paris next January"
>>> lod = [{'city':'Paris'}, {'month':'January'}]
>>> processed = TextLabeler(string, lod)
>>> processed.text
>>> Let's take a trip to [[ city ]] next [[ month ]]