Browse Source

Set up basics for mastodon.py, parser

Petra Lamborn 4 years ago
parent
commit
a32f8f5e68
2 changed files with 23 additions and 3 deletions
  1. 2
    0
      .gitignore
  2. 21
    3
      fedicurses.py

+ 2
- 0
.gitignore View File

@@ -108,3 +108,5 @@ ENV/
108 108
 # Rope project settings
109 109
 .ropeproject
110 110
 
111
+# mastodon.py secret files
112
+*.secret

+ 21
- 3
fedicurses.py View File

@@ -1,9 +1,27 @@
1 1
 import curses
2
+from html.parser import HTMLParser
3
+from mastodon import Mastodon
4
+
5
+class PostParser(HTMLParser):
6
+    def handle_starttag(self, tag, attrs):
7
+        print(tag)
8
+
9
+mastodon = Mastodon(
10
+        access_token = 'd100.club_usercred.secret',
11
+        api_base_url = 'd100.club'
12
+)
13
+
14
+print(mastodon.timeline()[0]["content"])
15
+
2 16
 
3 17
 def main(stdscr):
4 18
     stdscr.clear()
19
+    curses.halfdelay(10)
5 20
     i = 'c'
6
-    while i != 'q':
7
-        i = stdscr.getkey()
21
+    q = 0
22
+    con = True
23
+    while con:
24
+        i = stdscr.getch()
25
+        con = (i != ord('q'))
8 26
 
9
-curses.wrapper(main)
27
+#curses.wrapper(main)