-
Notifications
You must be signed in to change notification settings - Fork 0
/
grab_board_scratch.py
102 lines (75 loc) · 1.8 KB
/
grab_board_scratch.py
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
98
99
100
101
102
#-------------------------------------------------------------------------------
# Name: grab_board.py
# Purpose: Grab threads from one board
#
# Author: User
#
# Created: 18-11-2018
# Copyright: (c) User 2018
# Licence: <your licence>
#-------------------------------------------------------------------------------
# StdLib
import time
import os
import random
import logging
import logging.handlers
import datetime
import json
import cookielib
import re
# Remote libraries
import requests
import requests.exceptions
# local
import common
class board():
"""An 8ch board"""
def __init__(self):
return
class thread():
"""An 8ch thread"""
def __init__(self):
self.posts = []
return
def update(self):
logging.debug('Updating thread {0!r}'.format())
return
def db_push(self):
"""Shove the thread into the DB"""
class post():
"""An 8ch post"""
def __init__(self):
self.images = []
return
class image():
"""An 8ch image"""
def __init__(self):
self.thumbnail = None
return
class thumbnail():
"""An 8ch thumbnail"""
def __init__(self):
self.url = None
filename = None
filepath = None
time_fetched = None
time_uploaded = None
return
def dev():
logging.warning('running dev()')
logging.warning('exiting dev()')
return
def main():
dev()
return
if __name__ == '__main__':
common.setup_logging(os.path.join("debug", "grab_board_py8ch.log.txt"))# Setup logging
try:
# Load configurations here to make them global
main()
# Log exceptions
except Exception, e:
logging.critical("Unhandled exception!")
logging.exception(e)
logging.info("Program finished.")