from models import Session, FacebookUser, FacebookPage, FacebookGroup from lib import get_scraper, save_user, save_page import logging logging.basicConfig(level=logging.DEBUG) session = Session() scraper = get_scraper() buildchicago = session.query(FacebookPage).filter(FacebookPage.page_id==166962743387695).first() if not buildchicago: buildchicago = FacebookPage(page_id=166962743387695, username="******", name="Build Chicago") session.add(buildchicago) session.commit() for user in session.query(FacebookUser).all(): buildchicago.users.append(user) session.commit()
from models import Session, FacebookUser, FacebookPage, FacebookGroup from lib import get_scraper, save_user, save_page import logging logging.basicConfig(level=logging.DEBUG) session = Session() scraper = get_scraper(True) for user in session.query(FacebookUser).filter(FacebookUser.data=="todo").filter("username ~ '^\d+$'").all(): user.username = scraper.get_username_api(str(user.uid)) or str(user.uid) print user.uid, user.username session.commit()
from models import Session, FacebookUser, FacebookPage, FacebookGroup from lib import get_scraper, save_user, save_page import logging logging.basicConfig(level=logging.DEBUG) session = Session() scraper = get_scraper() for user in session.query(FacebookUser).all(): user.nu = 1 session.commit()
from models import Session, FacebookUser, FacebookPage, FacebookGroup from lib import get_scraper, save_user, save_page import logging logging.basicConfig(level=logging.DEBUG) session = Session() scraper = get_scraper(True) for user in session.query(FacebookUser).filter( FacebookUser.data == "todo").filter("username ~ '^\d+$'").all(): user.username = scraper.get_username_api(str(user.uid)) or str(user.uid) print user.uid, user.username session.commit()