Skip to content

Instantly share code, notes, and snippets.

@scoopseven
scoopseven / createsend_put_post_response.sh
Created October 3, 2019 16:49
createsend PUT operation doesn't return any data; it's inconsistent with the POST operation that returns the email address as a measure of success. Problematic code: https://github.com/campaignmonitor/createsend-python/blob/ff6500cc3e23b14779c65dd3fed62d9b9aecdd38/lib/createsend/subscriber.py#L41
In [4]: success = subscriber.update(new_email_address='krista@ad.net',
...: name='%s %s' % ('krista@ad.net', 'krista@ad.net'),
...: custom_fields='',
...: resubscribe='false',
...: consent_to_track='yes')
# PUT request
/api/v3.2/subscribers/2a0b1fadb2c256efee33b5da93eee9ed.json?email=krista%40ad.net
# body
{"RestartSubscriptionBasedAutoresponders": false, "ConsentToTrack": "yes", "Name": "krista@ad.net krista@ad.net", "Resubscribe": "false", "EmailAddress": "krista@ad.net", "CustomFields": ""}
# headers
def __eq__(self, other):
_NOTFOUND = object()
for attr in ['user', 'street', 'street2', 'city', 'region', 'zip', 'country']:
v1, v2 = [getattr(obj, attr, _NOTFOUND) for obj in [self, other]]
if v1 is _NOTFOUND or v2 is _NOTFOUND:
return False
elif v1 != v2:
return False
return True
@scoopseven
scoopseven / gist:5080445
Created March 4, 2013 06:41
Zinnia -> Mezzanine SQL Import
# Categories
insert into mezzanine_db.blog_blogcategory (id, site_id, title, slug)
select id, '1', title, slug from zinnia_db.zinnia_category;
# Entries/Posts
insert into mezzanine_db.blog_blogpost (id, site_id, title, slug, description, gen_description, status, publish_date, in_sitemap, content, user_id, allow_comments)
select id, '1', title, slug, excerpt, '1', '2', creation_date, '1', content, '1', '0' from zinnia_db.zinnia_entry;
# Category->Post Relationships
insert into mezzanine_db.blog_blogpost_categories (id, blogpost_id, blogcategory_id)
@scoopseven
scoopseven / gist:1240231
Created September 25, 2011 04:31
Control Tag Suggested Implementation
Take the ad that's in there and "unlock the code" via the helios interface. You should end up with something like this:
<a href="http://survey.questionmarket.com/surv/917485/ai_start.php?site=21&from_ec=0"><img src="http://someimage.gif"></a>
<!-- Add this control tag to the existing html -->
<img src="http://amch.questionmarket.com/adsc/d917485/21/934237/adscout.php?ord=[randnum]" height="1" width="1" border="0">
[
{
"pk": 3,
"model": "account.primarycontent",
"fields": {
"name": "Marketing"
}
},
{
"pk": 2,
MEDIA pre-checked============
Accounts on the Move
Around the Net In Media
Digital Outsider
Events Calendar
Feedback Loop
Gaming Insider
Mad Blog
Magazine Rack