-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsql_functions.py
709 lines (617 loc) · 67.3 KB
/
sql_functions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
#-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: User
#
# Created: 04/03/2015
# Copyright: (c) User 2015
# Licence: <your licence>
#-------------------------------------------------------------------------------
import sqlalchemy# Database library
from sqlalchemy.ext.declarative import declarative_base# Magic for ORM
from utils import *
import config # User specific settings
from tables import *# Table definitions
# General
def connect_to_db():
"""Provide a DB session
http://www.pythoncentral.io/introductory-tutorial-python-sqlalchemy/"""
logging.debug("Opening DB connection")
# add "echo=True" to see SQL being run
engine = sqlalchemy.create_engine(config.sqlalchemy_login, echo=config.echo_sql)
# Bind the engine to the metadata of the Base class so that the
# declaratives can be accessed through a DBSession instance
Base.metadata.bind = engine
Base.metadata.create_all(engine)
DBSession = sqlalchemy.orm.sessionmaker(bind=engine)
# A DBSession() instance establishes all conversations with the database
# and represents a "staging zone" for all the objects loaded into the
# database session object. Any change made against the objects in the
# session won't be persisted into the database until you call
# session.commit(). If you're not happy about the changes, you can
# revert all of them back to the last commit by calling
# session.rollback()
session = DBSession()
logging.debug("Session connected to DB")
return session
# Media
def check_if_hash_in_db(session,sha512base16_hash):
"""Check if a hash is in the media DB
Return a dict of the first found row if it is, otherwise return None"""
hash_query = sqlalchemy.select([Media]).where(Media.sha512base16_hash == sha512base16_hash)
hash_rows = session.execute(hash_query)
hash_row = hash_rows.fetchone()
if hash_row:
return hash_row
else:
return None
def check_if_media_url_in_DB(session,media_url):
"""Check if a URL is in the media DB
Return a dict of the first found row if it is, otherwise return None"""
media_url_query = sqlalchemy.select([Media]).where(Media.media_url == media_url)
media_url_rows = session.execute(media_url_query)
media_url_row = media_url_rows.fetchone()
if media_url_row:
return media_url_row
else:
return None
# Raw Posts
def add_raw_post(session,raw_post_dict,processed_post_dict,info_dict,blog_url,username,version=0):
"""Store the raw data from a post into the raw data table"""
# Ensure post is not already in DB
# Assuming blog url, postid, and timestamp will never all match on different posts
post_duplicate_check_query = sqlalchemy.select([RawPosts]).\
where(RawPosts.blog_domain == blog_url).\
where(RawPosts.all_posts_id == raw_post_dict["id"]).\
where(RawPosts.all_posts_timestamp == raw_post_dict["timestamp"])
post_duplicate_check_rows = session.execute(post_duplicate_check_query)
post_duplicate_check_row = post_duplicate_check_rows.fetchone()
if post_duplicate_check_row:
logging.error("add_raw_post() This post is already in the DB!")
logging.error("add_raw_post() raw_post_dict:"+repr(raw_post_dict))
logging.error("add_raw_post() post_duplicate_check_row:"+repr(post_duplicate_check_row))
logging.error("add_raw_post() repr(locals()):"+repr(locals()))
return
# Build row to insert
row_to_insert = {}
# Local stuff
row_to_insert["date_saved"] = get_current_unix_time()
row_to_insert["version"] = version# FIXME
# User info
row_to_insert["poster_username"] = username
row_to_insert["blog_domain"] = blog_url
# post identity
row_to_insert["all_posts_id"] = raw_post_dict["id"]
row_to_insert["all_posts_post_url"] = raw_post_dict["post_url"]
row_to_insert["all_posts_timestamp"] = raw_post_dict["timestamp"]
# Full post reencoded into JSON
row_to_insert["raw_post_json"] = raw_post_dict
row_to_insert["media_processed"] = False
if config.log_db_rows:
logging.debug("row_to_insert:"+repr(row_to_insert))
post_row = RawPosts(**row_to_insert)
session.add(post_row)
#read_post(session,post_url = raw_post_dict["post_url"])
return
def read_post(session,post_url):
posts_query = sqlalchemy.select([RawPosts]).\
where(RawPosts.all_posts_post_url == post_url)
posts_rows = session.execute(posts_query)
post_ids = []
for row in posts_rows:
logging.debug("row in db:"+repr(row))
return
def find_blog_posts(session,sanitized_username):# TODO Replace this with one that gives timestamps as well
"""Lookup a blog's posts in the DB and return a list of the IDs"""
logging.debug("find_blog_posts()"+"sanitized_username"+": "+repr(sanitized_username))
# select all posts with field "poster_username" matching our value
posts_query = sqlalchemy.select([RawPosts.all_posts_id]).where(RawPosts.poster_username == sanitized_username)
posts_rows = session.execute(posts_query)
post_ids = []
for row in posts_rows:
post_ids.append(row["all_posts_id"])
#logging.debug("find_blog_posts()"+"row"+": "+repr(row))
#logging.debug("find_blog_posts()"+"for "+repr(sanitized_username)+"post_ids"+": "+repr(post_ids))
return post_ids
def get_timestamp_of_last_post(session,blog_domain):
"""Look up the timestamp for the most recent post for this blog
If timestamp exists return it, otherwise return 0"""
# Grab the highest timestamp for this blog
timestamp_query = sqlalchemy.select([RawPosts]).\
where(RawPosts.blog_domain == blog_domain).\
order_by(RawPosts.all_posts_timestamp.desc())
timestamp_rows = session.execute(timestamp_query)
timestamp_row = timestamp_rows.fetchone()
if timestamp_row:
return timestamp_row["all_posts_timestamp"]
else:
return 0
# /Raw Posts
# Posts for website and stuff
def map_post_type(post_type_string):
"""Map API post types to integers for faster DB stuff"""
string_to_int_table = {
u"text":1,
u"photo":2,
u"quote":3,
u"link":4,
u"chat":5,
u"audio":6,
u"video":7,
u"answer":8,
}
return string_to_int_table[post_type_string]
def reverse_map_post_type(type_id):
int_to_string_table = {
1: u'text',
2: u'photo',
3: u'quote',
4: u'link',
5: u'chat',
6: u'audio',
7: u'video',
8: u'answer'
}
return int_to_string_table[type_id]
def insert_post_media_associations(session,post_id,media_id_list):
logging.debug("insert_post_media_associations() media_id_list:"+repr(media_id_list))
media_url_id_pairs = {}# {url: media_id}
# Find associations already in the db for this post and skip them
new_media_ids = []
for media_id in media_id_list:
select_id_query = sqlalchemy.select([media_associations]).\
where(media_associations.media_id == media_id).\
where(media_associations.post_id == post_id)
select_id_rows = session.execute(select_id_query)
select_id_row = select_id_rows.fetchone()
if select_id_row:
logging.debug("Skipping duplicate association: "+str(select_id_row))
media_url_id_pairs[select_id_row["media_url"]] = media_id
else:
new_media_ids += [media_id]
continue
logging.debug("insert_post_media_associations() new_media_ids:"+repr(new_media_ids))
# Add entries to the post-media association table
for new_media_id in new_media_ids:
# Ensure media row exists
verify_id_query = sqlalchemy.select([Media]).\
where(Media.media_id == new_media_id)
verify_id_rows = session.execute(verify_id_query)
verify_id_row = verify_id_rows.fetchone()
if not verify_id_row:# This should never be called becasue media ids are generated from existing rows
logging.error("No media row found for media_id:"+repr(media_id))
logging.error(rer(locals()))
raise ValueError
# Insert association row
media_association_row = media_associations(
post_id = post_id,
media_id = new_media_id
)
session.add(media_association_row)
media_url_id_pairs[verify_id_row["media_url"]] = new_media_id
continue
logging.debug("insert_post_media_associations() media_url_id_pairs:"+repr(media_url_id_pairs))
return media_url_id_pairs # {url: media_id}
def insert_photoset(session,post_id,post_dict,media_url_id_pairs):
"""Perform inserts for a post's photoset"""
logging.debug("Inserting photoset")
logging.debug("insert_photos() post_id:"+repr(post_id))
logging.debug("insert_photos() media_url_id_pairs:"+repr(media_url_id_pairs))
logging.debug("insert_photos() post_dict:"+repr(post_dict))
# Add root level stuff for this post
posts_photo_text_row = posts_photo_text(
post_id = post_id,
caption = post_dict["caption"]
)
session.add(posts_photo_text_row)
# Add each photo to a row in the photos table
photos = post_dict["photos"]
photo_num = 0
for photo in photos:
photo_num += 1
photo_url = photo["original_size"]["url"]
posts_photo_dict = {}
posts_photo_dict["caption"] = photo["caption"]
posts_photo_dict["url"] = photo_url
posts_photo_dict["order"] = photo_num
if photo_url in media_url_id_pairs.keys():
posts_photo_dict["media_id"] = media_url_id_pairs[photo_url]# {url: media_id}
else:
logging.error("Photo id could not be found! adding photo media_id as NULL instead")
appendlist(
photo_url,
list_file_path=os.path.join("debug","photoset_failed.txt"),
initial_text="# List of media URLS that could not be added to photosets.\n"
)
posts_photo_dict["post_id"] = post_id
posts_photo_row = posts_photo(**posts_photo_dict)
session.add(posts_photo_row)
logging.debug("Added photo "+repr(photo_num)+" : "+repr(posts_photo_dict))
continue
logging.debug("Finished inserting photoset.")
return
def insert_reblog_trail(session,post_id,post_dict):
# Store reblog trail
assert( "trail" in post_dict.keys() )
logging.debug("Saving trail for post")
trail_depth = 0
for trail_entry in post_dict["trail"]:
trail_depth += 1
logging.debug("Adding reblog trail; depth: "+repr(trail_depth))
# We want trail_entry["content"] if it exists,
# otherwise we can settle for trail_entry["content_abstract"]
# which appears to be the same thing under a different name
if ( "content" in trail_entry.keys() ):# Most posts will use this
content_field = trail_entry["content"]
elif ( "content_abstract" in trail_entry.keys() ):# Sometimes we only get this
content_field = trail_entry["content_abstract"]
else: # If we don't have a required field we can't process the post
logging.error("Reblog trail entry is missing either content or content_abstract field")
logging.error("locals: "+repr(locals()))
assert(False)# We should stop so this can be noticed and fixed.
post_reblog_trail_row = post_reblog_trail(
post_id = post_id,
depth = trail_depth,
content = content_field,
)
session.add(post_reblog_trail_row)
continue
return
def insert_one_post(session,post_dict,blog_id,media_id_list,prevent_duplicates=True):# WIP
"""Insert a single post into Twkr's new postgres tables
Only commit if all tables are set
Return True if successful.
"""
assert( type(post_dict) is type({}) )
assert( type(media_id_list) is type([]) )
logging.debug("insert_one_post() post_dict:"+repr(post_dict))
try:
if prevent_duplicates:
# Ensure post is not already in DB
pre_insert_check_query = sqlalchemy.select([posts]).\
where(posts.blog_id == blog_id).\
where(posts.source_id == post_dict["id"]).\
where(posts.timestamp == post_dict["timestamp"])
pre_insert_check_rows = session.execute(pre_insert_check_query)
pre_insert_check_row = pre_insert_check_rows.fetchone()
if pre_insert_check_row:
logging.error("This post is already in the DB!")
logging.error("pre_insert_check_row:"+repr(pre_insert_check_row))
return
assert(False)# This should not happen
raise ValueError # This should not happen
else:
logging.warning("insert_one_post() duplicate check disabled!")
# Insert into posts table
posts_row_dict = {}
#posts_dict["field"] = "value" # Example of setting a field
posts_row_dict["date_saved"] = get_current_unix_time() # Unix time to millisecond precision
posts_row_dict["blog_id"] = blog_id # local ID number of the blog
posts_row_dict["source_id"] = post_dict["id"] # ID number tumblr gave us for the post
posts_row_dict["post_type"] = map_post_type(post_dict["type"]) #
posts_row_dict["source_url"] = post_dict["post_url"] # using value the API gave us
posts_row_dict["timestamp"] = post_dict["timestamp"] # using value the API gave us
# Tags to a string
tags_string = ""
for tag in post_dict["tags"]:
tags_string += tag+","
tags_string = tags_string[:-1]
posts_row_dict["tags"] = tags_string
posts_row = posts(**posts_row_dict)
session.add(posts_row)
# Flush to let us get the local post_id
logging.debug("Flushing")
session.flush()
#logging.debug("committing post row")
#session.commit()# We have to commit this first for some reason?
post_id = posts_row.post_id
print post_id
# Add entries to the post-media association table
logging.debug("adding media associations")
media_url_id_pairs = insert_post_media_associations(session,post_id,media_id_list) # {url: media_id}
# Store reblog trail
if "trail" in post_dict.keys():
insert_reblog_trail(
session = session,
post_id = post_id,
post_dict = post_dict,
)
# -Deal with posttype-specific stuff-
# If photo, insert into posts_photo table
if (post_dict["type"] == "photo"):
logging.debug("posts_photo")
insert_photoset(
session = session,
post_id = post_id,
post_dict = post_dict,
media_url_id_pairs = media_url_id_pairs,
)
# If link, insert into posts_link table
if (post_dict["type"] == "link"):
logging.debug("posts_link")
posts_link_dict = {}
posts_link_dict["source_url"] = post_dict["url"]
posts_link_dict["source_title"] = post_dict["title"]
posts_link_dict["description"] = post_dict["description"]
posts_link_dict["post_id"] = post_id
posts_link_row = posts_link(**posts_link_dict)
session.add(posts_link_row)
# If answer, insert into posts_answer table
if (post_dict["type"] == "answer"):
logging.debug("posts_answer")
posts_answer_dict = {}
posts_answer_dict["asking_name"] = post_dict["asking_name"]
posts_answer_dict["asking_url"] = post_dict["asking_url"]
posts_answer_dict["question"] = post_dict["question"]
posts_answer_dict["answer"] = post_dict["answer"]
posts_answer_dict["post_id"] = post_id
posts_answer_row = posts_answer(**posts_answer_dict)
session.add(posts_answer_row)
# If text, insert into posts_text table
if (post_dict["type"] == "text"):
logging.debug("posts_text")
posts_text_dict = {}
posts_text_dict["title"] = post_dict["title"]
posts_text_dict["body"] = post_dict["body"]
posts_text_dict["post_id"] = post_id
posts_text_row = posts_text(**posts_text_dict)
session.add(posts_text_row)
# If quote, insert into posts_quote table
if (post_dict["type"] == "quote"):
logging.debug("posts_quote")
posts_quote_dict = {}
if "source_url" in post_dict.keys():
posts_quote_dict["source_url"] = post_dict["source_url"]
if "source_title" in post_dict.keys():
posts_quote_dict["source_title"] = post_dict["source_title"]
posts_quote_dict["source"] = post_dict["source"]
posts_quote_dict["text"] = post_dict["text"]
posts_quote_dict["post_id"] = post_id
posts_quote_row = posts_quote(**posts_quote_dict)
session.add(posts_quote_row)
# If chat, insert into posts_chat table
if (post_dict["type"] == "chat"):
logging.debug("posts_chat")
posts_chat_dict = {}
posts_chat_dict["title"] = post_dict["title"]
posts_chat_dict["body"] = post_dict["body"]
posts_chat_dict["dialogue_html"] = None
posts_chat_dict["dialogue_json"] = json.dumps(post_dict["dialogue"])
posts_chat_dict["post_id"] = post_id
posts_chat_row = posts_chat(**posts_chat_dict)
session.add(posts_chat_row)
# If audio
if (post_dict["type"] == "audio"):
logging.debug("post_audio")
post_audio_dict = {}
post_audio_dict["post_id"] = post_id,
if "audio_source_url" in post_dict.keys():
post_audio_dict["audio_source_url"] = post_dict["audio_source_url"]
if "album_art" in post_dict.keys():
album_art_url = post_dict["album_art"]
if "caption" in post_dict.keys():
post_audio_dict["caption"] = post_dict["caption"]
if "artist" in post_dict.keys():
post_audio_dict["artist"] = post_dict["artist"]
if "track_name" in post_dict.keys():
post_audio_dict["track_name"] = post_dict["track_name"]
if "audio_type" in post_dict.keys():
post_audio_dict["audio_type"] = post_dict["audio_type"]
if "source_title" in post_dict.keys():
post_audio_dict["source_title"] = post_dict["source_title"]
if "artist" in post_dict.keys():
post_audio_dict["artist"] = post_dict["artist"]
post_audio_row = post_audio(**post_audio_dict)
session.add(post_audio_row)
# If video
if (post_dict["type"] == "video"):
logging.debug("posts_video")
post_video_dict = {}
post_video_dict["post_id"] = post_id,
if "caption" in post_dict.keys():
post_video_dict["caption"] = post_dict["caption"],
if "video_type" in post_dict.keys():
post_video_dict["video_type"] = post_dict["video_type"],
if "permalink_url" in post_dict.keys():
post_video_dict["permalink_url"] = post_dict["permalink_url"],
if "thumbnail_url" in post_dict.keys():
post_video_dict["thumbnail_url"] = post_dict["thumbnail_url"],
post_video_row = post_video(**post_video_dict)
session.add(post_video_row)
return True
except:# Rollback if something is fucked up
session.rollback()
raise
# /Posts
# Blogs table
def add_blog(session,blog_url):
"""Make sure a blog is in the blogs table
return the internal ID number assigned to that blog"""
logging.debug("making sure blog is in db: "+repr(blog_url))
# Check if blog is already in DB, if it is return the id
blog_id_query = sqlalchemy.select([blogs.blog_id]).where(blogs.blog_url == blog_url)
blog_id_rows = session.execute(blog_id_query)
blog_id_row = blog_id_rows.fetchone()
if blog_id_row:
blog_id = blog_id_row["blog_id"]
logging.debug("blog_id: "+repr(blog_id))
return blog_id
else:
# If blog is not in DB, create a record for it and return the ID
# Create entry
blog_dict = {}
blog_dict["blog_url"] = blog_url
blogs_row = blogs(**blog_dict)
session.add(blogs_row)
session.commit()
# Return blog entry
return add_blog(session,blog_url)
def get_blog_media_settings(session,blog_id):
"""Get settings for this blog from the blogs table"""
DEFAULT_BLOG_MEDIA_SETTINGS = {
"save_external_links":True,
"save_photos":True,
"save_videos":False,
"save_audio":True,}
if blog_id is None:
logging.warning("No blog ID given! Using default settings for media.")
# Hardcoded defaults as temporary thing during coding
blog_settings_dict = DEFAULT_BLOG_MEDIA_SETTINGS
else:
# Look up settings from DB
settings_query = sqlalchemy.select([blogs]).where(blogs.blog_id == blog_id)
settings_rows = session.execute(settings_query)
settings_row = settings_rows.fetchone()
if settings_row is None:
logging.error("Can't load media settings from DB!")
raise ValueError
blog_settings_dict = {}
blog_settings_dict["save_external_links"] = True# settings_row["save_external_links"]
blog_settings_dict["save_photos"] = True# settings_row["save_photos"]
save_videos = settings_row["save_videos"]
logging.debug("save_videos for blog_id "+repr(blog_id)+" :"+repr(save_videos))
blog_settings_dict["save_videos"] = save_videos
blog_settings_dict["save_audio"] = True# settings_row["save_audio"]
logging.debug("blog_settings_dict: "+repr(blog_settings_dict))
return blog_settings_dict
# /Blogs table
def debug():
"""Temp code for debug"""
session = connect_to_db()
# Test adding blogs and get a blog id for debug code to use
blog_urls = [
#"staff.tumblr.com",
#"testsetsts2.tumblr.com",
"lunarshinestore.tumblr.com",
"atryl.tumblr.com",
]
for blog_url in blog_urls:
dummy_blog_id = add_blog(session,blog_url)
logging.debug("dummy_blog_id: "+repr(dummy_blog_id))
blog_media_settings_dict = get_blog_media_settings(session,dummy_blog_id)
logging.debug("blog_media_settings_dict: "+repr(blog_media_settings_dict))
#update_blog_theme(session,blog_url)
continue
#return
# debug an alternat reblog trail format that was found
alternate_reblog_trail_post_dict = {u'body': u'<p>It\u2019s been almost two years since we <a href="http://staff.tumblr.com/post/19785116691/policy-update">last updated</a> Tumblr\u2019s terms and policies. A lot has happened since then!</p>\n<p>To make sure these documents fully reflect our product and philosophies, and are as understandable and up-to-date as they can be, our Legal and Policy teams have taken the last few weeks (and a tremendous amount of care) to update our <a href="http://www.tumblr.com/policy/drafts/terms_of_service">Terms of Service</a>, <a href="http://www.tumblr.com/policy/drafts/privacy">Privacy Policy</a>, and <a href="http://www.tumblr.com/policy/drafts/community">Community Guidelines</a>.</p>\n<p>There are a fair number of changes, so we insist you read them all for yourself. Some notable updates include:</p>\n<ul><li>Cleanup to make all of the documents more readable</li>\n<li>Updates to reflect changes to our products over the last two years</li>\n<li>Information about how we work with our new parent company, Yahoo</li>\n<li>Credits for open source projects</li>\n<li>Some language that makes it easier for U.S. government organizations to blog on Tumblr</li>\n<li>An attribution policy reminding people not to be jerks</li>\n<li>Updated annotations (!)</li>\n</ul><p>You can review the drafts via the links above. You can also see every change, letter for letter, on <a href="https://github.com/tumblr/policy/compare/2cfe3c8668...adfff367b5#files_bucket">GitHub</a> (minus the plain English annotations).</p>\n<p>We\u2019re planning to officially launch the new terms soon and we\u2019d really love to hear any questions or concerns. Please write to <a href="mailto:[email protected]">[email protected]</a>.</p>', u'highlighted': [], u'reblog_key': u'FejUhHDh', u'format': u'html', u'timestamp': 1390592400, u'note_count': 15210, u'tags': [], u'id': 74407154392L, u'post_url': u'http://staff.tumblr.com/post/74407154392/its-been-almost-two-years-since-we-last-updated', u'trail': [{u'blog': {u'theme': {u'title_font_weight': u'bold', u'title_color': u'#FFFFFF', u'header_bounds': 0, u'title_font': u'Gibson', u'link_color': u'#56BC8A', u'header_image_focused': u'http://static.tumblr.com/10e607f9b9b4c588d1cbd6c9f8b564d9/3hpyv0p/nFBnlgttl/tumblr_static_1sssiwavcjs0gs4cggwsok040_2048_v2.gif', u'show_description': True, u'show_header_image': True, u'header_stretch': True, u'body_font': u'Helvetica Neue', u'show_title': True, u'header_image_scaled': u'http://static.tumblr.com/10e607f9b9b4c588d1cbd6c9f8b564d9/3hpyv0p/nFBnlgttl/tumblr_static_1sssiwavcjs0gs4cggwsok040_2048_v2.gif', u'avatar_shape': u'square', u'show_avatar': False, u'background_color': u'#37475c', u'header_image': u'http://static.tumblr.com/10e607f9b9b4c588d1cbd6c9f8b564d9/3hpyv0p/nFBnlgttl/tumblr_static_1sssiwavcjs0gs4cggwsok040.gif'}, u'name': u'staff'}, u'content': u'<p>It\u2019s been almost two years since we <a href="http://staff.tumblr.com/post/19785116691/policy-update">last updated</a> Tumblr\u2019s terms and policies. A lot has happened since then!</p>\n<p>To make sure these documents fully reflect our product and philosophies, and are as understandable and up-to-date as they can be, our Legal and Policy teams have taken the last few weeks (and a tremendous amount of care) to update our <a href="http://www.tumblr.com/policy/drafts/terms_of_service">Terms of Service</a>, <a href="http://www.tumblr.com/policy/drafts/privacy">Privacy Policy</a>, and <a href="http://www.tumblr.com/policy/drafts/community">Community Guidelines</a>.</p>\n<p>There are a fair number of changes, so we insist you read them all for yourself. Some notable updates include:</p>\n<ul><li>Cleanup to make all of the documents more readable</li>\n<li>Updates to reflect changes to our products over the last two years</li>\n<li>Information about how we work with our new parent company, Yahoo</li>\n<li>Credits for open source projects</li>\n<li>Some language that makes it easier for U.S. government organizations to blog on Tumblr</li>\n<li>An attribution policy reminding people not to be jerks</li>\n<li>Updated annotations (!)</li>\n</ul><p>You can review the drafts via the links above. You can also see every change, letter for letter, on <a href="https://github.com/tumblr/policy/compare/2cfe3c8668...adfff367b5#files_bucket">GitHub</a> (minus the plain English annotations).</p>\n<p>We\u2019re planning to officially launch the new terms soon and we\u2019d really love to hear any questions or concerns. Please write to <a href="mailto:[email protected]">[email protected]</a>.</p>', u'post': {u'id': u'74407154392'}, u'is_root_item': True, u'is_current_item': True}], u'state': u'published', u'reblog': {u'tree_html': u''}, u'short_url': u'http://tmblr.co/ZE5Fby15J0nBO', u'date': u'2014-01-24 19:40:00 GMT', u'title': None, u'type': u'text', u'slug': u'its-been-almost-two-years-since-we-last-updated', u'blog_name': u'staff'}
insert_one_post(
session = session,
post_dict = alternate_reblog_trail_post_dict,
blog_id = dummy_blog_id,
media_id_list = [],
prevent_duplicates = False
)
return
# Try each type of post to see what happens
## u"text":1,
## u"photo":2,
## u"quote":3,
## u"link":4,
## u"chat":5,
## u"audio":6,
## u"video":7,
## u"answer":8,
## # u"text":1,
## text_post_dict = {u'body': u'<p>It\u2019s been almost two years since we <a href="http://staff.tumblr.com/post/19785116691/policy-update">last updated</a> Tumblr\u2019s terms and policies. A lot has happened since then!</p>\n<p>To make sure these documents fully reflect our product and philosophies, and are as understandable and up-to-date as they can be, our Legal and Policy teams have taken the last few weeks (and a tremendous amount of care) to update our <a href="http://www.tumblr.com/policy/drafts/terms_of_service">Terms of Service</a>, <a href="http://www.tumblr.com/policy/drafts/privacy">Privacy Policy</a>, and <a href="http://www.tumblr.com/policy/drafts/community">Community Guidelines</a>.</p>\n<p>There are a fair number of changes, so we insist you read them all for yourself. Some notable updates include:</p>\n<ul><li>Cleanup to make all of the documents more readable</li>\n<li>Updates to reflect changes to our products over the last two years</li>\n<li>Information about how we work with our new parent company, Yahoo</li>\n<li>Credits for open source projects</li>\n<li>Some language that makes it easier for U.S. government organizations to blog on Tumblr</li>\n<li>An attribution policy reminding people not to be jerks</li>\n<li>Updated annotations (!)</li>\n</ul><p>You can review the drafts via the links above. You can also see every change, letter for letter, on <a href="https://github.com/tumblr/policy/compare/2cfe3c8668...adfff367b5#files_bucket">GitHub</a> (minus the plain English annotations).</p>\n<p>We\u2019re planning to officially launch the new terms soon and we\u2019d really love to hear any questions or concerns. Please write to <a href="mailto:[email protected]">[email protected]</a>.</p>', u'highlighted': [], u'reblog_key': u'FejUhHDh', u'format': u'html', u'timestamp': 1390592400, u'note_count': 15210, u'tags': [], u'id': 74407154392L, u'post_url': u'http://staff.tumblr.com/post/74407154392/its-been-almost-two-years-since-we-last-updated', u'trail': [{u'blog': {u'theme': {u'title_font_weight': u'bold', u'title_color': u'#FFFFFF', u'header_bounds': 0, u'title_font': u'Gibson', u'link_color': u'#56BC8A', u'header_image_focused': u'http://static.tumblr.com/10e607f9b9b4c588d1cbd6c9f8b564d9/3hpyv0p/nFBnlgttl/tumblr_static_1sssiwavcjs0gs4cggwsok040_2048_v2.gif', u'show_description': True, u'show_header_image': True, u'header_stretch': True, u'body_font': u'Helvetica Neue', u'show_title': True, u'header_image_scaled': u'http://static.tumblr.com/10e607f9b9b4c588d1cbd6c9f8b564d9/3hpyv0p/nFBnlgttl/tumblr_static_1sssiwavcjs0gs4cggwsok040_2048_v2.gif', u'avatar_shape': u'square', u'show_avatar': False, u'background_color': u'#37475c', u'header_image': u'http://static.tumblr.com/10e607f9b9b4c588d1cbd6c9f8b564d9/3hpyv0p/nFBnlgttl/tumblr_static_1sssiwavcjs0gs4cggwsok040.gif'}, u'name': u'staff'}, u'content': u'<p>It\u2019s been almost two years since we <a href="http://staff.tumblr.com/post/19785116691/policy-update">last updated</a> Tumblr\u2019s terms and policies. A lot has happened since then!</p>\n<p>To make sure these documents fully reflect our product and philosophies, and are as understandable and up-to-date as they can be, our Legal and Policy teams have taken the last few weeks (and a tremendous amount of care) to update our <a href="http://www.tumblr.com/policy/drafts/terms_of_service">Terms of Service</a>, <a href="http://www.tumblr.com/policy/drafts/privacy">Privacy Policy</a>, and <a href="http://www.tumblr.com/policy/drafts/community">Community Guidelines</a>.</p>\n<p>There are a fair number of changes, so we insist you read them all for yourself. Some notable updates include:</p>\n<ul><li>Cleanup to make all of the documents more readable</li>\n<li>Updates to reflect changes to our products over the last two years</li>\n<li>Information about how we work with our new parent company, Yahoo</li>\n<li>Credits for open source projects</li>\n<li>Some language that makes it easier for U.S. government organizations to blog on Tumblr</li>\n<li>An attribution policy reminding people not to be jerks</li>\n<li>Updated annotations (!)</li>\n</ul><p>You can review the drafts via the links above. You can also see every change, letter for letter, on <a href="https://github.com/tumblr/policy/compare/2cfe3c8668...adfff367b5#files_bucket">GitHub</a> (minus the plain English annotations).</p>\n<p>We\u2019re planning to officially launch the new terms soon and we\u2019d really love to hear any questions or concerns. Please write to <a href="mailto:[email protected]">[email protected]</a>.</p>', u'post': {u'id': u'74407154392'}, u'is_root_item': True, u'is_current_item': True}], u'state': u'published', u'reblog': {u'tree_html': u''}, u'short_url': u'http://tmblr.co/ZE5Fby15J0nBO', u'date': u'2014-01-24 19:40:00 GMT', u'title': None, u'type': u'text', u'slug': u'its-been-almost-two-years-since-we-last-updated', u'blog_name': u'staff'}
## insert_one_post(
## session = session,
## post_dict = text_post_dict,
## blog_id = dummy_blog_id,
## media_id_list = [],
## prevent_duplicates = False
## )
##
## # u"photo":2,
## photo_post_dict = {u'highlighted': [], u'image_permalink': u'http://staff.tumblr.com/image/81595826875', u'reblog_key': u'BU1z20aM', u'featured_in_tag': [u'Design'], u'format': u'html', u'timestamp': 1396544484, u'note_count': 23321, u'tags': [], u'trail': [], u'id': 81595826875L, u'post_url': u'http://staff.tumblr.com/post/81595826875', u'caption': u'', u'state': u'published', u'reblog': {u'tree_html': u''}, u'short_url': u'http://tmblr.co/ZE5Fby1B-VOAx', u'date': u'2014-04-03 17:01:24 GMT', u'photos': [{u'caption': u'', u'original_size': {u'url': u'http://38.media.tumblr.com/5f867e24acdf8365d34875acf489810a/tumblr_n3gr4l2Wtf1qz8q0ho1_500.gif', u'width': 500, u'height': 634}, u'alt_sizes': [{u'url': u'http://38.media.tumblr.com/5f867e24acdf8365d34875acf489810a/tumblr_n3gr4l2Wtf1qz8q0ho1_500.gif', u'width': 500, u'height': 634}, {u'url': u'http://38.media.tumblr.com/5f867e24acdf8365d34875acf489810a/tumblr_n3gr4l2Wtf1qz8q0ho1_400.gif', u'width': 400, u'height': 507}, {u'url': u'http://38.media.tumblr.com/5f867e24acdf8365d34875acf489810a/tumblr_n3gr4l2Wtf1qz8q0ho1_250.gif', u'width': 250, u'height': 317}, {u'url': u'http://38.media.tumblr.com/5f867e24acdf8365d34875acf489810a/tumblr_n3gr4l2Wtf1qz8q0ho1_100.gif', u'width': 100, u'height': 127}, {u'url': u'http://33.media.tumblr.com/5f867e24acdf8365d34875acf489810a/tumblr_n3gr4l2Wtf1qz8q0ho1_75sq.gif', u'width': 75, u'height': 75}]}], u'type': u'photo', u'slug': u'', u'blog_name': u'staff'}
## insert_one_post(
## session = session,
## post_dict = photo_post_dict,
## blog_id = dummy_blog_id,
## media_id_list = [],
## prevent_duplicates = False
## )
##
## # u"quote":3,
## quote_post_dict = {u'highlighted': [], u'source_title': u'news10.net', u'reblog_key': u'c6ueXgOR', u'format': u'html', u'timestamp': 1379703264, u'note_count': 23519, u'tags': [], u'id': 61775600495L, u'post_url': u'http://staff.tumblr.com/post/61775600495/the-majority-of-workers-waste-their-time-on', u'source': u'<p><a href="http://www.news10.net/news/article/257238/2/Forbes-64-of-employees-are-wasting-time-at-work">Forbes: 64% of employees wasting time at work</a></p>\n<p>Num! Ber! One!<br/>Num! Ber! One!</p>', u'state': u'published', u'text': u'The majority of workers waste their time on Tumblr, followed by Facebook, Twitter, Instagram, and SnapChat.', u'short_url': u'http://tmblr.co/ZE5FbyvY7Djl', u'date': u'2013-09-20 18:54:24 GMT', u'reblog': {u'tree_html': u''}, u'source_url': u'http://www.news10.net/news/article/257238/2/Forbes-64-of-employees-are-wasting-time-at-work', u'type': u'quote', u'slug': u'the-majority-of-workers-waste-their-time-on', u'blog_name': u'staff'}
## insert_one_post(
## session = session,
## post_dict = quote_post_dict,
## blog_id = dummy_blog_id,
## media_id_list = [],
## prevent_duplicates = False
## )
##
## # u"link":4,
## link_post_dict ={u'reblog_key': u'dFsxQKez', u'short_url': u'http://tmblr.co/ZE5Fby15ewm82', u'excerpt': None, u'id': 74774675970L, u'post_url': u'http://staff.tumblr.com/post/74774675970/vote-for-the-best-tumblr-of-the-year-shorty', u'author': None, u'tags': [], u'link_image': u'http://33.media.tumblr.com/tumblr_mzv7r7gTeQ1qz8q0h_og.png', u'highlighted': [], u'state': u'published', u'reblog': {u'tree_html': u''}, u'type': u'link', u'description': u'<p>Do you love a blog? Okay, how hard do you love it? If you love it truly, madly, deeply, you will nominate it for the annual Shorty Award for Tumblr of the Year.</p>\n<p>Nominees are now being accepted, and the winner will be honored at the official ceremony this April in New York City!</p>', u'featured_in_tag': [u'Design', u'Advertising'], u'format': u'html', u'timestamp': 1390867778, u'note_count': 1839, u'photos': [{u'caption': u'', u'original_size': {u'url': u'http://33.media.tumblr.com/tumblr_mzv7r7gTeQ1qz8q0h_og.png', u'width': 200, u'height': 200}, u'alt_sizes': []}], u'date': u'2014-01-28 00:09:38 GMT', u'slug': u'vote-for-the-best-tumblr-of-the-year-shorty', u'blog_name': u'staff', u'publisher': u'shortyawards.com', u'trail': [{u'blog': {u'theme': {u'title_font_weight': u'bold', u'title_color': u'#FFFFFF', u'header_bounds': 0, u'title_font': u'Gibson', u'link_color': u'#56BC8A', u'header_image_focused': u'http://static.tumblr.com/10e607f9b9b4c588d1cbd6c9f8b564d9/3hpyv0p/nFBnlgttl/tumblr_static_1sssiwavcjs0gs4cggwsok040_2048_v2.gif', u'show_description': True, u'show_header_image': True, u'header_stretch': True, u'body_font': u'Helvetica Neue', u'show_title': True, u'header_image_scaled': u'http://static.tumblr.com/10e607f9b9b4c588d1cbd6c9f8b564d9/3hpyv0p/nFBnlgttl/tumblr_static_1sssiwavcjs0gs4cggwsok040_2048_v2.gif', u'avatar_shape': u'square', u'show_avatar': False, u'background_color': u'#37475c', u'header_image': u'http://static.tumblr.com/10e607f9b9b4c588d1cbd6c9f8b564d9/3hpyv0p/nFBnlgttl/tumblr_static_1sssiwavcjs0gs4cggwsok040.gif'}, u'name': u'staff'}, u'content': u'<p>Do you love a blog? Okay, how hard do you love it? If you love it truly, madly, deeply, you will nominate it for the annual Shorty Award for Tumblr of the Year.</p>\n<p>Nominees are now being accepted, and the winner will be honored at the official ceremony this April in New York City!</p>', u'post': {u'id': u'74774675970'}, u'is_root_item': True, u'is_current_item': True}], u'url': u'http://shortyawards.com/category/6th/tumblr', u'title': u'Vote for the "Best Tumblr of the Year" Shorty Award'}
## insert_one_post(
## session = session,
## post_dict = link_post_dict,
## blog_id = dummy_blog_id,
## media_id_list = [],
## prevent_duplicates = False
## )
##
## # u"chat":5,
## chat_post_dict = {u'body': u"Hair: What hair color looks best on you and what's your natural color?\nSkin: Do you tan easily?\nEyes: What is your favorite show to watch?\nNose: What is your favorite perfume/candle fragrance?\nMouth: Do you want to kiss anyone right now?\nTongue: What was in your last meal?\nWindpipe: Do you sing?\nNeck: Do you wear necklaces?\nEars: How many piercings do you have (if any)?\nCheeks: Do you blush easily?\nWrists: Have you ever broken a bone?\nHands: Are you an artist/writer?\nFingers: Do you play an instrument?\nHeart: Are you in love? If so, does the one you love know?\nLungs: Do you smoke cigarettes?\nChest: Are your maternal/parental instincts strong?\nStomach: Do you feel confident in your body image?\nBack: Are you a virgin?\nHips: Do you like to dance?\nThighs: Has anyone ever called you fat or ugly?\nKnees: Have you ever cheated on someone?\nAnkles: Have you ever been arrested?\nFeet: Favorite pair of shoes?\nBrain: Anything you want to ask", u'highlighted': [], u'dialogue': [{u'phrase': u"What hair color looks best on you and what's your natural color?", u'name': u'Hair', u'label': u'Hair:'}, {u'phrase': u'Do you tan easily?', u'name': u'Skin', u'label': u'Skin:'}, {u'phrase': u'What is your favorite show to watch?', u'name': u'Eyes', u'label': u'Eyes:'}, {u'phrase': u'What is your favorite perfume/candle fragrance?', u'name': u'Nose', u'label': u'Nose:'}, {u'phrase': u'Do you want to kiss anyone right now?', u'name': u'Mouth', u'label': u'Mouth:'}, {u'phrase': u'What was in your last meal?', u'name': u'Tongue', u'label': u'Tongue:'}, {u'phrase': u'Do you sing?', u'name': u'Windpipe', u'label': u'Windpipe:'}, {u'phrase': u'Do you wear necklaces?', u'name': u'Neck', u'label': u'Neck:'}, {u'phrase': u'How many piercings do you have (if any)?', u'name': u'Ears', u'label': u'Ears:'}, {u'phrase': u'Do you blush easily?', u'name': u'Cheeks', u'label': u'Cheeks:'}, {u'phrase': u'Have you ever broken a bone?', u'name': u'Wrists', u'label': u'Wrists:'}, {u'phrase': u'Are you an artist/writer?', u'name': u'Hands', u'label': u'Hands:'}, {u'phrase': u'Do you play an instrument?', u'name': u'Fingers', u'label': u'Fingers:'}, {u'phrase': u'Are you in love? If so, does the one you love know?', u'name': u'Heart', u'label': u'Heart:'}, {u'phrase': u'Do you smoke cigarettes?', u'name': u'Lungs', u'label': u'Lungs:'}, {u'phrase': u'Are your maternal/parental instincts strong?', u'name': u'Chest', u'label': u'Chest:'}, {u'phrase': u'Do you feel confident in your body image?', u'name': u'Stomach', u'label': u'Stomach:'}, {u'phrase': u'Are you a virgin?', u'name': u'Back', u'label': u'Back:'}, {u'phrase': u'Do you like to dance?', u'name': u'Hips', u'label': u'Hips:'}, {u'phrase': u'Has anyone ever called you fat or ugly?', u'name': u'Thighs', u'label': u'Thighs:'}, {u'phrase': u'Have you ever cheated on someone?', u'name': u'Knees', u'label': u'Knees:'}, {u'phrase': u'Have you ever been arrested?', u'name': u'Ankles', u'label': u'Ankles:'}, {u'phrase': u'Favorite pair of shoes?', u'name': u'Feet', u'label': u'Feet:'}, {u'phrase': u'Anything you want to ask', u'name': u'Brain', u'label': u'Brain:'}], u'source_title': u'goodbyebenedict', u'reblog_key': u'nkIanbaM', u'format': u'html', u'timestamp': 1426909760, u'note_count': 1148774, u'tags': [], u'id': 114188519623L, u'post_url': u'http://bigponiesinc.tumblr.com/post/114188519623/ask-me-about-my-body', u'state': u'published', u'short_url': u'http://tmblr.co/ZNohWm1gMAeZ7', u'date': u'2015-03-21 03:49:20 GMT', u'title': u'Ask me about my body. (\xac\u203f\xac)', u'source_url': u'http://goodbyebenedict.tumblr.com/post/47433081091', u'type': u'chat', u'slug': u'ask-me-about-my-body', u'blog_name': u'bigponiesinc'}
## insert_one_post(
## session = session,
## post_dict = chat_post_dict,
## blog_id = dummy_blog_id,
## media_id_list = [],
## prevent_duplicates = False
## )
##
## # audio 6
## bandcamp_post_dict = {u'reblog_key': u'AbxPRz4A', u'short_url': u'http://tmblr.co/ZE5FbyhlEyOo', u'audio_url': u'http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=ca33bbe78b527483940c050bd627a33d&id=2851867171&nl=1&stream=1&ts=1428792368.0', u'player': u'<iframe class="bandcamp_audio_player" width="500" height="120" src="http://bandcamp.com/EmbeddedPlayer/size=medium/bgcol=ffffff/linkcol=0687f5/notracklist=true/transparent=true/track=2851867171/" allowtransparency="true" frameborder="0"></iframe>', u'id': 46963344946, u'album': u'Hunter Hunted - EP', u'post_url': u'http://staff.tumblr.com/post/46963344946/listen-up-our-audio-player-just-got-super-rad', u'source_title': u'Bandcamp', u'tags': [u'hunter hunted', u'keep together', u'music on tumblr', u'bands on tumblr'], u'highlighted': [], u'state': u'published', u'track_name': u'Keep Together', u'type': u'audio', u'featured_in_tag': [u'Music', u'Design'], u'format': u'html', u'timestamp': 1364937324, u'note_count': 5105, u'source_url': u'http://hunterhuntedmusic.bandcamp.com/track/keep-together', u'date': u'2013-04-02 21:15:24 GMT', u'plays': 110209, u'slug': u'listen-up-our-audio-player-just-got-super-rad', u'album_art': u'http://31.media.tumblr.com/tumblr_mkn8sgrMDN1qz8q0h_dSDeaHscmUuv4sl8epf8mAC32IU_cover.jpg', u'blog_name': u'staff', u'is_external': True, u'artist': u'Hunter Hunted', u'caption': u'<p>Listen up: our audio player just got super rad!</p>\n<ul><li><span>Fancy new audio visualizer</span></li>\n<li><span>Bigger album art</span></li>\n<li><span>Click and drag to skip around</span></li>\n</ul><p>Hit play and happy listening!</p>', u'audio_type': u'bandcamp', u'audio_source_url': u'http://popplers5.bandcamp.com/download/track?enc=mp3-128&fsig=ca33bbe78b527483940c050bd627a33d&id=2851867171&nl=1&stream=1&ts=1428792368.0', u'embed': u'<iframe class="bandcamp_audio_player" width="100%" height="120" src="http://bandcamp.com/EmbeddedPlayer/size=medium/bgcol=ffffff/linkcol=0687f5/notracklist=true/transparent=true/track=2851867171/" allowtransparency="true" frameborder="0"></iframe>'}
## insert_one_post(
## session = session,
## post_dict = bandcamp_post_dict,
## blog_id = dummy_blog_id,
## media_id_list = [],
## prevent_duplicates = False
## )
##
## # video 7
## video_post_dict = {u'reblog_key': u'5VvbpiMU', u'video_url': u'http://vt.tumblr.com/tumblr_n22yhozyhf1qz8q0h.mp4', u'reblog': {u'tree_html': u''}, u'thumbnail_width': 720, u'player': [{u'width': 250, u'embed_code': u'\n<video id=\'embed-5545b5404d38f208480212\' class=\'crt-video crt-skin-default\' width=\'250\' height=\'166\' poster=\'http://media.tumblr.com/tumblr_n22yhozyhf1qz8q0h_frame1.jpg\' preload=\'none\' data-crt-video data-crt-options=\'{"duration":53,"hdUrl":false,"filmstrip":{"url":"http:\\/\\/25.media.tumblr.com\\/previews\\/tumblr_n22yhozyhf1qz8q0h_filmstrip.jpg","width":"200","height":"134"}}\' >\n <source src="http://api.tumblr.com/video_file/78875723128/tumblr_n22yhozyhf1qz8q0h" type="video/mp4">\n</video>\n'}, {u'width': 400, u'embed_code': u'\n<video id=\'embed-5545b5404da06666687965\' class=\'crt-video crt-skin-default\' width=\'400\' height=\'266\' poster=\'http://media.tumblr.com/tumblr_n22yhozyhf1qz8q0h_frame1.jpg\' preload=\'none\' data-crt-video data-crt-options=\'{"duration":53,"hdUrl":false,"filmstrip":{"url":"http:\\/\\/25.media.tumblr.com\\/previews\\/tumblr_n22yhozyhf1qz8q0h_filmstrip.jpg","width":"200","height":"134"}}\' >\n <source src="http://api.tumblr.com/video_file/78875723128/tumblr_n22yhozyhf1qz8q0h" type="video/mp4">\n</video>\n'}, {u'width': 500, u'embed_code': u'\n<video id=\'embed-5545b5404e166096811803\' class=\'crt-video crt-skin-default\' width=\'500\' height=\'333\' poster=\'http://media.tumblr.com/tumblr_n22yhozyhf1qz8q0h_frame1.jpg\' preload=\'none\' data-crt-video data-crt-options=\'{"duration":53,"hdUrl":false,"filmstrip":{"url":"http:\\/\\/25.media.tumblr.com\\/previews\\/tumblr_n22yhozyhf1qz8q0h_filmstrip.jpg","width":"200","height":"134"}}\' >\n <source src="http://api.tumblr.com/video_file/78875723128/tumblr_n22yhozyhf1qz8q0h" type="video/mp4">\n</video>\n'}], u'duration': 53, u'id': 78875723128L, u'post_url': u'http://staff.tumblr.com/post/78875723128/operators-are-standing-by-call-now-thank-you', u'tags': [u'features'], u'highlighted': [], u'state': u'published', u'short_url': u'http://tmblr.co/ZE5Fby19TN0Lu', u'html5_capable': True, u'type': u'video', u'format': u'html', u'timestamp': 1394225635, u'note_count': 1438, u'video_type': u'tumblr', u'trail': [{u'blog': {u'theme': {u'title_font_weight': u'bold', u'title_color': u'#FFFFFF', u'header_bounds': 0, u'title_font': u'Gibson', u'link_color': u'#56BC8A', u'header_image_focused': u'http://static.tumblr.com/10e607f9b9b4c588d1cbd6c9f8b564d9/3hpyv0p/nFBnlgttl/tumblr_static_1sssiwavcjs0gs4cggwsok040_2048_v2.gif', u'show_description': True, u'show_header_image': True, u'header_stretch': True, u'body_font': u'Helvetica Neue', u'show_title': True, u'header_image_scaled': u'http://static.tumblr.com/10e607f9b9b4c588d1cbd6c9f8b564d9/3hpyv0p/nFBnlgttl/tumblr_static_1sssiwavcjs0gs4cggwsok040_2048_v2.gif', u'avatar_shape': u'square', u'show_avatar': False, u'background_color': u'#37475c', u'header_image': u'http://static.tumblr.com/10e607f9b9b4c588d1cbd6c9f8b564d9/3hpyv0p/nFBnlgttl/tumblr_static_1sssiwavcjs0gs4cggwsok040.gif'}, u'name': u'staff'}, u'content': u'<p>Operators are standing by. <a href="http://tumblr.com/settings/account">Call now!</a></p>\n<p><em>(Thank you, <a class="tumblelog" href="http://tmblr.co/m75Dmwi6xWV_PQIiRtNSswQ">Jonny</a> and <a class="tumblelog" href="http://tmblr.co/mbmuHBE8CENpM7ix2H5jBfQ">Zack</a>)</em></p>', u'post': {u'id': u'78875723128'}, u'is_root_item': True, u'is_current_item': True}], u'date': u'2014-03-07 20:53:55 GMT', u'thumbnail_height': 480, u'slug': u'operators-are-standing-by-call-now-thank-you', u'blog_name': u'staff', u'caption': u'<p>Operators are standing by. <a href="http://tumblr.com/settings/account">Call now!</a></p>\n<p><em>(Thank you, <a class="tumblelog" href="http://tmblr.co/m75Dmwi6xWV_PQIiRtNSswQ">Jonny</a> and <a class="tumblelog" href="http://tmblr.co/mbmuHBE8CENpM7ix2H5jBfQ">Zack</a>)</em></p>', u'thumbnail_url': u'http://media.tumblr.com/tumblr_n22yhozyhf1qz8q0h_frame1.jpg'}
## insert_one_post(
## session = session,
## post_dict = video_post_dict,
## blog_id = dummy_blog_id,
## media_id_list = [],
## prevent_duplicates = False
## )
##
## # answer 8
## answer_post_dict = {u'highlighted': [], u'asking_url': None, u'reblog_key': u'O3UPhQYC', u'format': u'html', u'asking_name': u'Anonymous', u'timestamp': 1430518955, u'note_count': 43253, u'tags': [], u'question': u'lauren will you tell us a story', u'trail': [{u'blog': {u'theme': {u'title_font_weight': u'bold', u'header_full_height': 1226, u'title_color': u'#8f1e03', u'header_bounds': u'87,647,433,31', u'title_font': u'Courier New', u'link_color': u'#ffdd00', u'header_image_focused': u'http://static.tumblr.com/cafca27bb4f69629bf936818efb44e6f/88apzkd/fEXnhmx2i/tumblr_static_tumblr_static_983gvr4ppg4cgkgcs8c8owk4o_focused_v3.png', u'show_description': True, u'header_full_width': 677, u'header_focus_width': 616, u'header_stretch': True, u'show_header_image': True, u'body_font': u'Helvetica Neue', u'show_title': True, u'header_image_scaled': u'http://static.tumblr.com/cafca27bb4f69629bf936818efb44e6f/88apzkd/h29nhmx2f/tumblr_static_983gvr4ppg4cgkgcs8c8owk4o_2048_v2.png', u'avatar_shape': u'circle', u'show_avatar': True, u'header_focus_height': 346, u'background_color': u'#f38321', u'header_image': u'http://static.tumblr.com/cafca27bb4f69629bf936818efb44e6f/88apzkd/h29nhmx2f/tumblr_static_983gvr4ppg4cgkgcs8c8owk4o.png'}, u'name': u'iguanamouth'}, u'content': u'<p>ok heres something</p><p>around a year ago someone asked me to draw <a href="http://iguanamouth.tumblr.com/post/82902281208/draw-danny-devito-as-a-kitty">danny devito as a kitty</a>, spawning this terrible terrible image\xa0</p><figure data-orig-width="500" data-orig-height="406" class="tmblr-full"><img src="https://41.media.tumblr.com/d7549754fd8c427d3393eb702939652f/tumblr_inline_nnld4fWtJH1qmoaae_540.png" alt="image" data-orig-width="500" data-orig-height="406"></figure><p>time passes. a lot of time passes. then two months ago i get an email from a group of people called <a href="https://www.facebook.com/fpoafm">FPOAFM</a> doing a pottery installation event, and theyre going around gathering artwork from artists to put onto cups and dishes to sell,, in exchange for a few pieces with the artists work on them</p><p>and i said SURE you can use some of my stuff \u2026 . but in exchange.\u2026 <b>\xa0i want something with kitty devito on it. </b>i dont care if you put it on anything else, but one item that i get in return has to have this cat man abomination</p><p>i give them my address and a few images and months pass. i forget about it. THEN literally two days ago i get this big package on my doorstep, and INSIDE OF IT\u2026. is the holy grail</p><p>in addition to <a href="https://40.media.tumblr.com/cdd10d787d5bd9c4ab797fca37671cb0/tumblr_nneimxvAoS1rhtthso2_r3_1280.png">two</a> <a href="https://40.media.tumblr.com/7e01bf6e04497f0c9da80ed0b83cc3df/tumblr_nneimxvAoS1rhtthso3_r2_540.png">plates</a> is this incredible porcelain cup with the fabled kitty devito on it, proudly grinning his terrible cat grin</p><figure data-orig-width="800" data-orig-height="885" class="tmblr-full"><img src="https://41.media.tumblr.com/aca0ef3ca89612a513ef9143a439b48d/tumblr_inline_nnldwbZNR91qmoaae_540.png" alt="image" data-orig-width="800" data-orig-height="885"></figure><p>the thing that pushes this cup into the Far Reaches of Awful isnt just the image stamped on it. its that it is one hundred percent made from a mold of a styrofoam cup</p><figure data-orig-width="800" data-orig-height="600" class="tmblr-full"><img src="https://40.media.tumblr.com/7ce202e1b1877d34c0211876cdbb575e/tumblr_inline_nnleakjIpO1qmoaae_540.png" alt="image" data-orig-width="800" data-orig-height="600"></figure><p>its finger presses on the rim, those little lines going around</p><figure data-orig-width="800" data-orig-height="600" class="tmblr-full"><img src="https://36.media.tumblr.com/75f6a2b06915bac6aec356d18f226a47/tumblr_inline_nnleefM9Ty1qmoaae_540.png" alt="image" data-orig-width="800" data-orig-height="600"></figure><p>and all this jargon on the bottom, right under the glaze. the amount of effort that went into reproducing this styrofoam cup is incredible and i can stick it in my shelf and drink soup from it at four in the morning with danny devitos smug cat face looking out over everything i do, forever. follow your dreams</p>', u'post': {u'id': u'117728731307'}, u'is_root_item': True}, {u'blog': {u'theme': {u'title_font_weight': u'bold', u'title_color': u'#FFFFFF', u'header_bounds': 0, u'title_font': u'Gibson', u'link_color': u'#56BC8A', u'header_image_focused': u'http://static.tumblr.com/10e607f9b9b4c588d1cbd6c9f8b564d9/3hpyv0p/nFBnlgttl/tumblr_static_1sssiwavcjs0gs4cggwsok040_2048_v2.gif', u'show_description': True, u'show_header_image': True, u'header_stretch': True, u'body_font': u'Helvetica Neue', u'show_title': True, u'header_image_scaled': u'http://static.tumblr.com/10e607f9b9b4c588d1cbd6c9f8b564d9/3hpyv0p/nFBnlgttl/tumblr_static_1sssiwavcjs0gs4cggwsok040_2048_v2.gif', u'avatar_shape': u'square', u'show_avatar': False, u'background_color': u'#37475c', u'header_image': u'http://static.tumblr.com/10e607f9b9b4c588d1cbd6c9f8b564d9/3hpyv0p/nFBnlgttl/tumblr_static_1sssiwavcjs0gs4cggwsok040.gif'}, u'name': u'staff'}, u'content': u'<p>Have a follow-your-dreams weekend, Tumblr.</p>', u'post': {u'id': u'117887933455'}, u'is_current_item': True}], u'id': 117887933455L, u'post_url': u'http://staff.tumblr.com/post/117887933455/lauren-will-you-tell-us-a-story', u'answer': u'<p><a class="tumblr_blog" href="http://iguanamouth.tumblr.com/post/117728731307/lauren-will-you-tell-us-a-story">iguanamouth</a>:</p>\n\n<blockquote><p>ok heres something</p><p>around a year ago someone asked me to draw <a href="http://iguanamouth.tumblr.com/post/82902281208/draw-danny-devito-as-a-kitty">danny devito as a kitty</a>, spawning this terrible terrible image\xa0</p><figure data-orig-width="500" data-orig-height="406" class="tmblr-full"><img src="https://41.media.tumblr.com/d7549754fd8c427d3393eb702939652f/tumblr_inline_nnld4fWtJH1qmoaae_540.png" alt="image" data-orig-width="500" data-orig-height="406"/></figure><p>time passes. a lot of time passes. then two months ago i get an email from a group of people called <a href="https://www.facebook.com/fpoafm">FPOAFM</a> doing a pottery installation event, and theyre going around gathering artwork from artists to put onto cups and dishes to sell,, in exchange for a few pieces with the artists work on them</p><p>and i said SURE you can use some of my stuff \u2026 . but in exchange.\u2026 <b>\xa0i want something with kitty devito on it. </b>i dont care if you put it on anything else, but one item that i get in return has to have this cat man abomination</p><p>i give them my address and a few images and months pass. i forget about it. THEN literally two days ago i get this big package on my doorstep, and INSIDE OF IT\u2026. is the holy grail</p><p>in addition to <a href="https://40.media.tumblr.com/cdd10d787d5bd9c4ab797fca37671cb0/tumblr_nneimxvAoS1rhtthso2_r3_1280.png">two</a> <a href="https://40.media.tumblr.com/7e01bf6e04497f0c9da80ed0b83cc3df/tumblr_nneimxvAoS1rhtthso3_r2_540.png">plates</a> is this incredible porcelain cup with the fabled kitty devito on it, proudly grinning his terrible cat grin</p><figure data-orig-width="800" data-orig-height="885" class="tmblr-full"><img src="https://41.media.tumblr.com/aca0ef3ca89612a513ef9143a439b48d/tumblr_inline_nnldwbZNR91qmoaae_540.png" alt="image" data-orig-width="800" data-orig-height="885"/></figure><p>the thing that pushes this cup into the Far Reaches of Awful isnt just the image stamped on it. its that it is one hundred percent made from a mold of a styrofoam cup</p><figure data-orig-width="800" data-orig-height="600" class="tmblr-full"><img src="https://40.media.tumblr.com/7ce202e1b1877d34c0211876cdbb575e/tumblr_inline_nnleakjIpO1qmoaae_540.png" alt="image" data-orig-width="800" data-orig-height="600"/></figure><p>its finger presses on the rim, those little lines going around</p><figure data-orig-width="800" data-orig-height="600" class="tmblr-full"><img src="https://36.media.tumblr.com/75f6a2b06915bac6aec356d18f226a47/tumblr_inline_nnleefM9Ty1qmoaae_540.png" alt="image" data-orig-width="800" data-orig-height="600"/></figure><p>and all this jargon on the bottom, right under the glaze. the amount of effort that went into reproducing this styrofoam cup is incredible and i can stick it in my shelf and drink soup from it at four in the morning with danny devitos smug cat face looking out over everything i do, forever. follow your dreams</p></blockquote><p><p>Have a follow-your-dreams weekend, Tumblr.</p></p>', u'state': u'published', u'reblog': {u'tree_html': u'<p><a class="tumblr_blog" href="http://iguanamouth.tumblr.com/post/117728731307/lauren-will-you-tell-us-a-story">iguanamouth</a>:</p><blockquote><p>ok heres something</p><p>around a year ago someone asked me to draw <a href="http://iguanamouth.tumblr.com/post/82902281208/draw-danny-devito-as-a-kitty">danny devito as a kitty</a>, spawning this terrible terrible image\xa0</p><figure data-orig-width="500" data-orig-height="406" class="tmblr-full"><img src="https://41.media.tumblr.com/d7549754fd8c427d3393eb702939652f/tumblr_inline_nnld4fWtJH1qmoaae_540.png" alt="image" data-orig-width="500" data-orig-height="406"/></figure><p>time passes. a lot of time passes. then two months ago i get an email from a group of people called <a href="https://www.facebook.com/fpoafm">FPOAFM</a> doing a pottery installation event, and theyre going around gathering artwork from artists to put onto cups and dishes to sell,, in exchange for a few pieces with the artists work on them</p><p>and i said SURE you can use some of my stuff \u2026 . but in exchange.\u2026 <b>\xa0i want something with kitty devito on it. </b>i dont care if you put it on anything else, but one item that i get in return has to have this cat man abomination</p><p>i give them my address and a few images and months pass. i forget about it. THEN literally two days ago i get this big package on my doorstep, and INSIDE OF IT\u2026. is the holy grail</p><p>in addition to <a href="https://40.media.tumblr.com/cdd10d787d5bd9c4ab797fca37671cb0/tumblr_nneimxvAoS1rhtthso2_r3_1280.png">two</a> <a href="https://40.media.tumblr.com/7e01bf6e04497f0c9da80ed0b83cc3df/tumblr_nneimxvAoS1rhtthso3_r2_540.png">plates</a> is this incredible porcelain cup with the fabled kitty devito on it, proudly grinning his terrible cat grin</p><figure data-orig-width="800" data-orig-height="885" class="tmblr-full"><img src="https://41.media.tumblr.com/aca0ef3ca89612a513ef9143a439b48d/tumblr_inline_nnldwbZNR91qmoaae_540.png" alt="image" data-orig-width="800" data-orig-height="885"/></figure><p>the thing that pushes this cup into the Far Reaches of Awful isnt just the image stamped on it. its that it is one hundred percent made from a mold of a styrofoam cup</p><figure data-orig-width="800" data-orig-height="600" class="tmblr-full"><img src="https://40.media.tumblr.com/7ce202e1b1877d34c0211876cdbb575e/tumblr_inline_nnleakjIpO1qmoaae_540.png" alt="image" data-orig-width="800" data-orig-height="600"/></figure><p>its finger presses on the rim, those little lines going around</p><figure data-orig-width="800" data-orig-height="600" class="tmblr-full"><img src="https://36.media.tumblr.com/75f6a2b06915bac6aec356d18f226a47/tumblr_inline_nnleefM9Ty1qmoaae_540.png" alt="image" data-orig-width="800" data-orig-height="600"/></figure><p>and all this jargon on the bottom, right under the glaze. the amount of effort that went into reproducing this styrofoam cup is incredible and i can stick it in my shelf and drink soup from it at four in the morning with danny devitos smug cat face looking out over everything i do, forever. follow your dreams</p></blockquote>'}, u'short_url': u'http://tmblr.co/ZE5Fby1jognmF', u'date': u'2015-05-01 22:22:35 GMT', u'type': u'answer', u'slug': u'lauren-will-you-tell-us-a-story', u'blog_name': u'staff'}
## insert_one_post(
## session = session,
## post_dict = answer_post_dict,
## blog_id = dummy_blog_id,
## media_id_list = [],
## prevent_duplicates = False
## )
##
## #
## photoset_comment_post_dict = {u'reblog_key': u'BNYQKHhT', u'reblog': {u'comment': u'<h2><b>Tumblr Tuesday: Extremely Literal Blogs</b></h2><p><b>Sad Dinosaur Facts </b>(<a href="http://tmblr.co/m5wPOikY2afr5YDl8AhWKBg">saddinosaurfacts</a>)<br>This is a blog about sad dinosaur facts.</p><p><b>Google Sheep View </b>(<a href="http://tmblr.co/mjA7Kkgp6i0a80pSi9wlsYw">googlesheepview</a>)<br>This is blog about sheep on Google Street View.</p><p><b>Serious Baby </b>(<a href="http://tmblr.co/mXCujD9Cncw9b600nnOE06w">seriousbaby</a>)<br>This is one serious baby.</p><p><b>A Study in Bee Movie</b> (<a href="http://tmblr.co/mb1nalG3ZmAq6qK7s7CT3Yw">astudyinbeemovie</a>)<br>This is a study in Bee Movie.</p><p><b>Epic Conducting Photos </b>(<a href="http://tmblr.co/mwrJHhEsRZ0xfyhswAJ7PsQ">epicconductingphotos</a>)<br>These are some epic conducting photos.</p><p><i>Bernstein bouncing via <a href="http://tmblr.co/mwrJHhEsRZ0xfyhswAJ7PsQ">epicconductingphotos</a> </i></p>', u'tree_html': u''}, u'id': 120560915667L, u'post_url': u'http://staff.tumblr.com/post/120560915667/tumblr-tuesday-extremely-literal-blogs-sad', u'source_title': u'epicconductingphotos', u'image_permalink': u'http://staff.tumblr.com/image/120560915667', u'tags': [u'Tumblr Tuesday'], u'highlighted': [], u'state': u'published', u'short_url': u'http://tmblr.co/ZE5Fby1mH-PJJ', u'type': u'photo', u'format': u'html', u'timestamp': 1433284209, u'note_count': 3080, u'source_url': u'http://epicconductingphotos.tumblr.com/post/103856485613/lenny-in-da-club-like', u'trail': [{u'content': u'<h2><b>Tumblr Tuesday: Extremely Literal Blogs</b></h2><p><b>Sad Dinosaur Facts </b>(<a href="http://tmblr.co/m5wPOikY2afr5YDl8AhWKBg">saddinosaurfacts</a>)<br>This is a blog about sad dinosaur facts.</p><p><b>Google Sheep View </b>(<a href="http://tmblr.co/mjA7Kkgp6i0a80pSi9wlsYw">googlesheepview</a>)<br>This is blog about sheep on Google Street View.</p><p><b>Serious Baby </b>(<a href="http://tmblr.co/mXCujD9Cncw9b600nnOE06w">seriousbaby</a>)<br>This is one serious baby.</p><p><b>A Study in Bee Movie</b> (<a href="http://tmblr.co/mb1nalG3ZmAq6qK7s7CT3Yw">astudyinbeemovie</a>)<br>This is a study in Bee Movie.</p><p><b>Epic Conducting Photos </b>(<a href="http://tmblr.co/mwrJHhEsRZ0xfyhswAJ7PsQ">epicconductingphotos</a>)<br>These are some epic conducting photos.</p><p><i>Bernstein bouncing via <a href="http://tmblr.co/mwrJHhEsRZ0xfyhswAJ7PsQ">epicconductingphotos</a>\xa0</i></p>', u'content_raw': u'<h2><b>Tumblr Tuesday: Extremely Literal Blogs</b></h2><p><b>Sad Dinosaur Facts </b>(<a href="http://tmblr.co/m5wPOikY2afr5YDl8AhWKBg">saddinosaurfacts</a>)<br>This is a blog about sad dinosaur facts.</p><p><b>Google Sheep View </b>(<a href="http://tmblr.co/mjA7Kkgp6i0a80pSi9wlsYw">googlesheepview</a>)<br>This is blog about sheep on Google Street View.</p><p><b>Serious Baby </b>(<a href="http://tmblr.co/mXCujD9Cncw9b600nnOE06w">seriousbaby</a>)<br>This is one serious baby.</p><p><b>A Study in Bee Movie</b> (<a href="http://tmblr.co/mb1nalG3ZmAq6qK7s7CT3Yw">astudyinbeemovie</a>)<br>This is a study in Bee Movie.</p><p><b>Epic Conducting Photos </b>(<a href="http://tmblr.co/mwrJHhEsRZ0xfyhswAJ7PsQ">epicconductingphotos</a>)<br>These are some epic conducting photos.</p><p><i>Bernstein bouncing via <a href="http://tmblr.co/mwrJHhEsRZ0xfyhswAJ7PsQ">epicconductingphotos</a> </i></p>', u'is_current_item': True, u'blog': {u'theme': {u'title_font_weight': u'bold', u'title_color': u'#FFFFFF', u'header_bounds': 0, u'title_font': u'Gibson', u'link_color': u'#56BC8A', u'header_image_focused': u'http://static.tumblr.com/10e607f9b9b4c588d1cbd6c9f8b564d9/3hpyv0p/nFBnlgttl/tumblr_static_1sssiwavcjs0gs4cggwsok040_2048_v2.gif', u'show_description': True, u'show_header_image': True, u'header_stretch': True, u'body_font': u'Helvetica Neue', u'show_title': True, u'header_image_scaled': u'http://static.tumblr.com/10e607f9b9b4c588d1cbd6c9f8b564d9/3hpyv0p/nFBnlgttl/tumblr_static_1sssiwavcjs0gs4cggwsok040_2048_v2.gif', u'avatar_shape': u'square', u'show_avatar': False, u'background_color': u'#37475c', u'header_image': u'http://static.tumblr.com/10e607f9b9b4c588d1cbd6c9f8b564d9/3hpyv0p/nFBnlgttl/tumblr_static_1sssiwavcjs0gs4cggwsok040.gif'}, u'name': u'staff'}, u'is_root_item': True, u'post': {u'id': u'120560915667'}}], u'date': u'2015-06-02 22:30:09 GMT', u'slug': u'tumblr-tuesday-extremely-literal-blogs-sad', u'blog_name': u'staff', u'photos': [{u'caption': u'', u'original_size': {u'url': u'http://31.media.tumblr.com/cea4b6bccb27671c4947de7ca10db3b5/tumblr_npc6l1VqRY1qz8q0ho2_r1_400.gif', u'width': 320, u'height': 240}, u'alt_sizes': [{u'url': u'http://31.media.tumblr.com/cea4b6bccb27671c4947de7ca10db3b5/tumblr_npc6l1VqRY1qz8q0ho2_r1_400.gif', u'width': 320, u'height': 240}, {u'url': u'http://38.media.tumblr.com/cea4b6bccb27671c4947de7ca10db3b5/tumblr_npc6l1VqRY1qz8q0ho2_r1_250.gif', u'width': 250, u'height': 188}, {u'url': u'http://31.media.tumblr.com/cea4b6bccb27671c4947de7ca10db3b5/tumblr_npc6l1VqRY1qz8q0ho2_r1_100.gif', u'width': 100, u'height': 75}, {u'url': u'http://38.media.tumblr.com/cea4b6bccb27671c4947de7ca10db3b5/tumblr_npc6l1VqRY1qz8q0ho2_r1_75sq.gif', u'width': 75, u'height': 75}]}], u'link_url': u'http://epicconductingphotos.tumblr.com/post/103856485613/lenny-in-da-club-like', u'caption': u'<h2><b>Tumblr Tuesday: Extremely Literal Blogs</b></h2><p><b>Sad Dinosaur Facts </b>(<a href="http://tmblr.co/m5wPOikY2afr5YDl8AhWKBg">saddinosaurfacts</a>)<br/>This is a blog about sad dinosaur facts.</p><p><b>Google Sheep View </b>(<a href="http://tmblr.co/mjA7Kkgp6i0a80pSi9wlsYw">googlesheepview</a>)<br/>This is blog about sheep on Google Street View.</p><p><b>Serious Baby </b>(<a href="http://tmblr.co/mXCujD9Cncw9b600nnOE06w">seriousbaby</a>)<br/>This is one serious baby.</p><p><b>A Study in Bee Movie</b> (<a href="http://tmblr.co/mb1nalG3ZmAq6qK7s7CT3Yw">astudyinbeemovie</a>)<br/>This is a study in Bee Movie.</p><p><b>Epic Conducting Photos </b>(<a href="http://tmblr.co/mwrJHhEsRZ0xfyhswAJ7PsQ">epicconductingphotos</a>)<br/>These are some epic conducting photos.</p><p><i>Bernstein bouncing via <a href="http://tmblr.co/mwrJHhEsRZ0xfyhswAJ7PsQ">epicconductingphotos</a>\xa0</i></p>'}
## insert_one_post(
## session = session,
## post_dict = photoset_comment_post_dict,
## blog_id = dummy_blog_id,
## media_id_list = [],
## prevent_duplicates = False
## )
## return
def main():
try:
setup_logging(log_file_path=os.path.join("debug","sql_functions_log.txt"))
debug()
logging.info("Finished, exiting.")
pass
except Exception, e:# Log fatal exceptions
logging.critical("Unhandled exception!")
logging.exception(e)
return
if __name__ == '__main__':
main()