-
-
Save pkafei/4710933 to your computer and use it in GitHub Desktop.
This is what I have so far
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 sys | |
import mom | |
from mom import Session, Feed | |
def _create_feeds(urls): | |
session = Session() | |
for url in urls: | |
if not session.query(Feed).filter(Feed.feed_url == url).first(): | |
feed = Feed( | |
feed_url=url, | |
last_seen=datetime.utcfromtimestamp(0)) | |
session.add(feed) | |
session.commit() | |
def _urls_from_txtfile("urls.txt"): | |
with open("urls.txt", 'r') as urlfile: | |
for line in urlfile: | |
print 'importing: ', line | |
yield line | |
if __name__ == '__main__': | |
try: | |
mom.db.Base.metadata.create_all(mom.env.engine) | |
except Exception as e: | |
print(e) | |
:q 38,5 Bot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment