twitter #2

Merged
s434708 merged 50 commits from twitter into master 2022-06-09 19:42:33 +02:00
2 changed files with 3 additions and 5 deletions
Showing only changes of commit 12a946c88a - Show all commits

View File

@ -20,9 +20,7 @@ def create_app():
twitter_db.init_app(app)
campaign_db.init_app(app)
twitter_db.drop_all(app=app)
twitter_db.create_all(app=app)
campaign_db.drop_all(app=app)
campaign_db.create_all(app=app)
app.register_blueprint(twitter, url_prefix='/twitter')

View File

@ -68,9 +68,9 @@ def add_twitter_account():
dot_index = trimmed_text.rfind(".")
space_index = trimmed_text.rfind(" ")
if dot_index > 0:
tweet_text = trimmed_text[:dot_index].capitalize()
tweet_text = trimmed_text[:dot_index + 1].capitalize()
else:
tweet_text = trimmed_text[:space_index].capitalize()
tweet_text = trimmed_text[:space_index + 1].capitalize()
# create post on twitter
oauth = OAuth1Session(
@ -82,7 +82,7 @@ def add_twitter_account():
response = oauth.post(
"https://api.twitter.com/2/tweets",
json={"text": tweet_text + str(dot_index) + str(space_index)},
json={"text": tweet_text},
).json()['data']
# save campaign to database