Esempio n. 1
0
       self.url= url
       self.title  = title
       self.category  = category
       blg.doBloggerActivity(  self.title.replace("\"", "")   ,self.description.replace("\"", "") + '  '  +   urllib.unquote_plus(self.url).replace("\"", "")  , 'Kabir   Seth' ,self.category   )
       twt.sendTweet(   self.title.replace("\"", "")    + '  ' +   self.description.replace("\"", "") + '  '  +   urllib.unquote_plus(self.url).replace("\"", "")) , 'Kabir   Seth' ,  self.category    
     def __str__(self):
       return 'BookMark ID  : %s, Bookmark Hashval :%s ,  desc :  %s    ,  url:  %s   ,Title   :  %s  , Category  :  %s   ' % (self.bookmark_id,  self.description , self.url , self.title , self.category, self.hashval)
     def __getitem__(self, bookmark_id):
         try  :
             return[{ 'selected'   : False  ,   'bookmark_id'  :  entry['bookmark_id']   ,    'category'   :   entry['category']  , 'hashval' :  entry['hashval']   ,  'description' :   entry['description']  ,   'title'  :  entry['title'] ,  'url'  :   entry['url'] }  for    entry   in   cache.listBookMark  if  entry['bookmark_id']  ==  bookmark_id    ][0]
         except :
              return None
 
 out =[]
 ip  = Instapaper('instapaper', insta_user ,insta_password)
 listBookMark = ip.getAllBookMarks()
 print  listBookMark
 print  len(listBookMark)
 try: 
     import simplejson as json
 except:
      import json
 out  =[{'selected'   : False  ,   'bookmark_id'  :    entry['bookmark_id']  or  ""  ,   'category'  :    entry['category']  or  ""  , 'hashval'  :    entry['hashval'] ,  'description'  :    entry['description']   or  ""  ,
   'title'  :   entry['title'] or  ""  , 'url'  :    entry['url']  or  ""  } for    entry  in   listBookMark  ]
 print listBookMark
 print json.dumps(out)
 templatepath ="c:/xampp/htdocs/newsletter"
 html = file('%s/preheader.htm'%templatepath, 'r').read()
 html = html +  file('%s/header.htm'%templatepath, 'r').read()               
 html = html + """<table width="500" class='out' border="1" data-dynamic="%s">""" % json.dumps(out)
 html = html + file('%s/footer.htm'%templatepath, 'r').read()
Esempio n. 2
0

if (
    blogger_email == ""
    or blogger_password == ""
    or insta_user == ""
    or insta_password == ""
    or mailchimp_user == ""
    or mailchimp_password == ""
):
    print (
        "python NewLetterUtil.py --blogger_email [blogger_email] --blogger_password  [blogger_password]   --insta_user  [insta_user] --insta_password [insta_password]  --mailchimp_user [mailchimp_user] --mailchimp_password [mailchimp_password]   --postdir  [postdir]  --create_newsletter [create_newsletter]  "
    )
    sys.exit(2)

dumpFile = "instapaper.pickle"
ip = Instapaper(dumpfile, insta_user, insta_password)
cache = BookMarkCache(dumpFile)
bookMarkList = ip.getAllBookMarks()
print bookMarkList
for b in bookMarkList:
    bmk = BookMark(b)
    cache[bmk] = {"bookmark_id": b["bookmark_id"], "hashval": b["hashval"]}
    entry = cache.get(b["bookmark_id"])
    ip.run()
    ip.save_pickle("instapaper.pickle")
url = "http://localhost/newsletter.php"


webbrowser.open_new(url)
Esempio n. 3
0
        mailchimp_password = a
    if o == "--create_newsletter":
        create_newsletter = a

if verbose > 0:
    print AGENTNAME, "version", __version__
    print " Blogger Email  :  %s  \n  Blogger  Password  :  %s  \n Insta  User  :  %s \n  Insta password  %s \n   Mailchimp  User  :  %s  \n Mailchimp  password  : %s \n   Create_NewsLetter : %s \n" % (
        blogger_email, blogger_password, insta_user, insta_password,
        mailchimp_user, mailchimp_password, create_newsletter)

if blogger_email == '' or blogger_password == '' or insta_user == '' or insta_password == '' or mailchimp_user == '' or mailchimp_password == '':
    print(
        'python NewLetterUtil.py --blogger_email [blogger_email] --blogger_password  [blogger_password]   --insta_user  [insta_user] --insta_password [insta_password]  --mailchimp_user [mailchimp_user] --mailchimp_password [mailchimp_password]   --postdir  [postdir]  --create_newsletter [create_newsletter]  '
    )
    sys.exit(2)

dumpFile = "instapaper.pickle"
ip = Instapaper(dumpfile, insta_user, insta_password)
cache = BookMarkCache(dumpFile)
bookMarkList = ip.getAllBookMarks()
print bookMarkList
for b in bookMarkList:
    bmk = BookMark(b)
    cache[bmk] = {'bookmark_id': b['bookmark_id'], 'hashval': b['hashval']}
    entry = cache.get(b['bookmark_id'])
    ip.run()
    ip.save_pickle('instapaper.pickle')
url = 'http://localhost/newsletter.php'

webbrowser.open_new(url)