Пример #1
0
	print ("Could not extract title and links from page")
	sys.exit(0)


# title was already processed then stop
if settings['title'] == title:
	print ("No new articles today.")
	sys.exit(0)

##############
# send each link to Readability
error = False
counter = 0
for link in links:
	#print("trying to send link " + link)
	try: # fails if article already existing
		response = rdd.add_bookmark(link)
		counter = counter +1
	except:
		error = True

if not error:
	settings['title'] = title # try not again for today anymore
	print("Successfully sent " + str(counter) + " links to Readability")
else:
	print("An error did occur or today's articles were already sent to Readability. Please try again tomorrow.")	
	
# finally save all optionally changed settings
parser.saveSettings(settings, settingsFile)

Пример #2
0
keys = parser.getSettings(api_file)
if keys == False or not keys['consumerKey'] or not keys['consumerSecret']:
		# input of key and secret
		inp_key= "";
		while len(inp_key) < 2:
			inp_key = raw_input("Your Readability developer API key: ")
			
		inp_secret = "";
		while len(inp_secret) < 2:
			inp_secret = raw_input("Your Readability developer API secret: ")
	
		keys = {}
		keys["consumerKey"] = inp_key
		keys["consumerSecret"] = inp_secret
 	
		parser.saveSettings(keys, api_file)
		
# ask for user credentials
print ("Please enter your Readability user credentials. They will NOT be stored and just used once.")

credentials = False
while credentials == False:
	# input of key and secret
	inpUser= "";
	while len(inpUser) < 2:
		inpUser = raw_input("Your Readability username: "******"";
	while len(inpPwd) < 2:
		inpPwd = raw_input("Your Readability password: ")