Now it exit when find first already published feed
This commit is contained in:
pare
3e89fb8a50
commit
9726ed0a64
S'han modificat 1 arxius amb 31 adicions i 28 eliminacions
|
@ -1,3 +1,4 @@
|
||||||
|
import pdb
|
||||||
import os
|
import os
|
||||||
import feedparser
|
import feedparser
|
||||||
from mastodon import Mastodon
|
from mastodon import Mastodon
|
||||||
|
@ -25,6 +26,11 @@ def get_parameter( parameter, file_path ):
|
||||||
print(file_path + " Missing parameter %s "%parameter)
|
print(file_path + " Missing parameter %s "%parameter)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# main
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
|
||||||
# Load secrets from secrets file
|
# Load secrets from secrets file
|
||||||
secrets_filepath = "secrets/secrets.txt"
|
secrets_filepath = "secrets/secrets.txt"
|
||||||
uc_client_id = get_parameter("uc_client_id", secrets_filepath)
|
uc_client_id = get_parameter("uc_client_id", secrets_filepath)
|
||||||
|
@ -52,10 +58,7 @@ mastodon = Mastodon(
|
||||||
# Initialise access headers
|
# Initialise access headers
|
||||||
headers={ 'Authorization': 'Bearer %s'%uc_access_token }
|
headers={ 'Authorization': 'Bearer %s'%uc_access_token }
|
||||||
|
|
||||||
###############################################################################
|
#######################################################################
|
||||||
# main
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
|
|
||||||
publish = 0
|
publish = 0
|
||||||
|
|
||||||
|
@ -69,7 +72,6 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
###################################################################
|
###################################################################
|
||||||
# check database if feed is already published
|
# check database if feed is already published
|
||||||
###################################################################
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
|
@ -140,3 +142,4 @@ if __name__ == '__main__':
|
||||||
else:
|
else:
|
||||||
|
|
||||||
print("Any new feeds")
|
print("Any new feeds")
|
||||||
|
sys.exit(0)
|
||||||
|
|
Loading…
Referencia en una nova incidència