-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfastapi_main.py
More file actions
49 lines (37 loc) · 1.34 KB
/
fastapi_main.py
File metadata and controls
49 lines (37 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from SearchingTwitters.searching_tweets import searchTweets
from fastapi import FastAPI
import uvicorn
from directMessage.direct_messages import direct_messages
from newsApp.News_post import news_post
from newsApp.News_df import news_df
from twitterPost.Tweet_relative_account_bot import twitter_account_bot
app = FastAPI()
@app.get("/")
async def root():
"""Home Page with GET HTTP Method"""
return {"message": "Hello! This is the home page for querying the cryptocurrency data."}
@app.post("/search_Tweets")
async def search_Tweets(coins:str, max_results:int):
if max_results <= 250:
searchTweets(coins, int(max_results/len(coins)))
return {"message": "Done"}
else:
return {"message": "Max Results is too high, try to lower the max results"}
@app.post("/Twitter_Message")
async def Twitter_message(message):
direct_messages(message)
return {"message": "Message Send"}
@app.post("/News_data_update")
async def Update_crypto_news():
news_df()
return {"message": "News Updated"}
@app.post("/News_Post")
async def post_crypto_news():
news_post()
return {"message": "News Posted"}
@app.post("/Twitter_Account_repost")
async def repost_twitter_account():
twitter_account_bot()
return {"message": "Account Reposted"}
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8080)