Esempio n. 1
0
def change_access_token():
    global access_token
    print """Head to the following URL and get a new access token for the user/Page which you would like to use Facebook as!

https://developers.facebook.com/tools/explorer/
"""
    at_raw=cm.raw_input_lb("Paste your new access token here:\n> ")
    bw=open("%s/access_token"%cm.cfg_dir,'w')
    bw.write(at_raw)
    bw.close()
    read_access_token()
    ret=check_auth()
    return ret
Esempio n. 2
0
def resume_chk():
    resumecheck_obj=open("%s/IDs.txt"%cm.resume_dir,'r')
    resumecheck=resumecheck_obj.read()
    resumecheck_obj.close()
    if resumecheck == '':
        cm.active_dir = cm.work_dir
    else:
        print "Data from last session was found. Resume session?\nType Y to continue, or anything else to discard and start a new session."
        choice=str(cm.raw_input_lb("> ")).lower().find("y")
        if choice != -1:
            print "Resuming..."
            cm.active_dir = cm.resume_dir
        else:
            print "Resume canceled."
            cm.active_dir = cm.work_dir
            cm.empty_file("%s/IDs.txt"%cm.resume_dir)
Esempio n. 3
0
def import_content_txt(action):
    global imported_content
    imported_content_obj=open("%s/Content.txt"%cm.work_dir,'r')
    imported_content=imported_content_obj.read()
    imported_content_obj.close()
    print "Content:"
    print imported_content
    print "\nDo you wish to %s using this content? Press ENTER to continue, or fill in your new content and press ENTER to change it."%action
    choice=cm.raw_input_lb("> ")
    if choice is "":
        return imported_content
    else:
        tbw_obj=open("%s/Content.txt"%cm.work_dir,'w')
        tbw_obj.write(choice)
        tbw_obj.close()
        import_content_txt(action)
Esempio n. 4
0
def auth_choose():
    global graph
    authenticated=False
    while authenticated is False:
        print "Authenticating..."
        token_name=check_auth()
        print "Authorised: %s"%token_name
        print "\nContinue as this user?\nPress ENTER to continue, or type 'no' and press ENTER to change your access token."
        authchoice=cm.raw_input_lb("> ")
        # TODO: add ability to interrupt with ESC instead of typing no
        if authchoice is "":
            authenticated=True
            return graph
        else:
            print "Authentication canceled."
            access_token="null"
            change_access_token()