-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
58 lines (48 loc) · 2.62 KB
/
main.py
File metadata and controls
58 lines (48 loc) · 2.62 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
50
51
52
53
54
55
56
57
58
from fastapi import FastAPI
import random
app = FastAPI()
# we will build two simple endpoints
# side hustles
# money_quotes
side_hustles = [
"Freelancing - Start offering your skills online!",
"Dropshipping - Sell without handling inventory!",
"Stock Market - Invest and watch your money grow!",
"Affiliate Marketing - Earn by promoting products!",
"Crypto Trading - Buy and sell digital assets!",
"Online Courses - Share your knowledge and earn!",
"Print-on-Demand - Sell custom-designed products!",
"Blogging - Create content and earn through ads and sponsorships!",
"YouTube Channel - Monetize videos through ads and sponsorships!",
"Social Media Management - Manage accounts for brands and influencers!",
"App Development - Create mobile or web applications for businesses!",
]
money_quotes = [
"The way to get started is to quit talking and begin doing. – Walt Disney",
"Formal education will make you a living; self-education will make you a fortune. – Jim Rohn",
"If you don’t find a way to make money while you sleep, you will work until you die. – Warren Buffett",
"Do not save what is left after spending, but spend what is left after saving. – Warren Buffett",
"Money is a terrible master but an excellent servant. – P.T. Barnum",
"You must gain control over your money or the lack of it will forever control you. – Dave Ramsey",
"Opportunities don’t happen. You create them. – Chris Grosser",
"Don’t stay in bed unless you can make money in bed. – George Burns",
"Money often costs too much. – Ralph Waldo Emerson",
"Never depend on a single income. Make an investment to create a second source. – Warren Buffett",
"It’s not about having lots of money. It’s about knowing how to manage it. – Anonymous",
"Rich people have small TVs and big libraries, and poor people have small libraries and big TVs. – Zig Ziglar",
"Being rich is having money; being wealthy is having time. – Margaret Bonnano",
"A wise person should have money in their head, but not in their heart. – Jonathan Swift",
"Money grows on the tree of persistence. – Japanese Proverb",
]
@app.get("/side_hustles")
def get_side_hustles(api_key: str):
"""Returns a random side hustle idea."""
if api_key != "123456789":
return {"error": "Invalid API key"}
return{"side_hustle": random.choice(side_hustles)}
@app.get("/money_quotes")
def get_money_quotes(api_key: str):
"""Returns a random money quote."""
if api_key != "123456789":
return {"error": "Invalid API key"}
return{"money_quote": random.choice(money_quotes)}