-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsources.py
More file actions
99 lines (56 loc) · 1.75 KB
/
sources.py
File metadata and controls
99 lines (56 loc) · 1.75 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# region INIT
import requests, os
# !!!!!!!
from data import Post
# endregion
# region BASE SOURCES
class BaseSourceSpotify:
name = "Spotify Source"
api_url = "https://api.spotify.com/api/v1"
auth_token = ("TOKWNSLSJDL") # TODO: security
def __init__():
pass
def get_playlists():
return []
class BaseSourceWordpress:
name = ""
api_url = ""
auth_token = ""
def __init__(self):
pass
def get_posts(self, filters: dict):
# TODO: http requst to API URL
url = self.api_url + "/posts"
response = requests.get(url)
# TODO: Adapters
# latest_posts2 = []
# for item in latest_posts:
# item2 = Post(id = item.id, title = item.title.rendered)
# # item2.id =
# latest_posts2.append(item2)
return []
# return latest_posts2
# endregion
# TODO: implement adapters?
# region SOURCES
class Sources:
# !!!!!!!
class MyyyBloggg(BaseSourceWordpress):
name = "My Personal Blog!!!"
api_url = "https://johnsblog1234.wordpress.com/api/v1"
auth_token = os.environ.get("MYYYBLOGGG_AUTH_TOKEN")
class MyyyPlaylistsss(BaseSourceSpotify):
name = "My Playlists!!!"
auth_token = os.environ.get("MYYYPLAYLISTSSS_AUTH_TOKEN")
# some random custom data i want
class MyyyJokes:
def __init__(self) -> None:
pass
def get_joke(self):
return "this is a joke"
# connect to other stuff
class MyHouseIOT:
def turn_on_garden_lights_and_set_relax_mood():
# ..send http calls to my house IOT system..
return {"status": "Mood set, sir!"}
# endregion