Exemplo n.º 1
0
def add_item(user='', password='', url=None,
             title=None, selection=None, jsonp=None,
             redirect=None, response_info=False):
    return Instapaper(user, password).add_item(url,title=title,
                                               selection=selection, jsonp=jsonp,
                                               redirect=redirect,
                                               response_info=response_info)
Exemplo n.º 2
0
 def authorize(self, email, password):
     self.insta = Instapaper(email , password)
     (code, message) = self.insta.auth()
     if code == 403:
         self.login()
     else:
         self.config.set(self.section, 'email', email)
         self.config.set(self.section, 'password', password)
         self.saveConfig()
Exemplo n.º 3
0
def auth(user='', password=''):
    return Instapaper(user, password).auth()
    try:
        config = open(os.path.expanduser('~') + '/.instapaperrc')
        for line in config:
            matches = login.match(line)
            if matches:
                args.username = matches.group(1).strip()
                args.password = matches.group(2).strip()
                break
        if '' == args.username:
            print >> sys.stderr, 'No username:password line found in ~/.instapaperrc'
            ap.exit(-1)
    except IOError:
        ap.error('Please specify a username with -u/--username.')

# Log in to the Instapaper API.
instapaper = Instapaper(args.username, args.password)
(auth_status, auth_message) = instapaper.auth()

# 200: OK
# 403: Invalid username or password.
# 500: The service encountered an error.
if 200 != auth_status:
    print >> sys.stderr, auth_message
    ap.exit(-1)

# Get the Reading List items
rlr = ReadingListReader()
articles = rlr.read()

for article in articles:
Exemplo n.º 5
0
                  access_token_secret=ACCESS_TOKEN_SECRET)

# Read latest tweet ID scanned from log
F = open(os.path.join(os.path.dirname(__file__), HN_TWITTER) + '.txt', 'a+')
# the above will create the file if it does not exist
F.close()
F = open(os.path.join(os.path.dirname(__file__), HN_TWITTER) + '.txt', 'r+')
LAST_ID = F.readline()

# GetUserTimeline(self, user_id=None, screen_name=None, since_id=None, max_id=None,
#                 count=None, include_rts=True, trim_user=None, exclude_replies=None)
STATUSES = API.GetUserTimeline(screen_name=HN_TWITTER, since_id=LAST_ID, count=200)

if len(STATUSES) > 0:
    # Instapaper Library
    i = Instapaper(INSTAPAPER_UN, INSTAPAPER_PW)

    EXPANDER = URLExpander()

    URLS = get_urls(STATUSES)
    URLS = filter_urls(URLS)

    print ''

    for url in URLS:
        print "added to Instapaper:", url
        i.add_item(url, '')

    print 'Done!'

    # Log latest tweet