-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.py
executable file
·79 lines (61 loc) · 2.14 KB
/
settings.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
# Scrapy settings for reddit_scraper project
BOT_NAME = 'reddit_scraper'
SPIDER_MODULES = ['reddit_scraper.spiders']
NEWSPIDER_MODULE = 'reddit_scraper.spiders'
# Obey robots.txt rules
ROBOTSTXT_OBEY = True
# Configure maximum concurrent requests performed by Scrapy (default: 16)
CONCURRENT_REQUESTS = 32
# Configure a delay for requests for the same website (default: 0)
DOWNLOAD_DELAY = 3
# The download delay setting will honor only one of:
CONCURRENT_REQUESTS_PER_DOMAIN = 16
CONCURRENT_REQUESTS_PER_IP = 16
# Disable cookies (enabled by default)
COOKIES_ENABLED = False
# Disable Telnet Console (enabled by default)
TELNETCONSOLE_ENABLED = False
# Override the default request headers:
DEFAULT_REQUEST_HEADERS = {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language': 'en',
}
# Enable or disable spider middlewares
SPIDER_MIDDLEWARES = {
'reddit_scraper.middlewares.RedditScraperSpiderMiddleware': 543,
}
# Enable or disable downloader middlewares
DOWNLOADER_MIDDLEWARES = {
'reddit_scraper.middlewares.RedditScraperDownloaderMiddleware': 543,
}
# Enable or disable extensions
EXTENSIONS = {
'scrapy.extensions.telnet.TelnetConsole': None,
}
# Configure item pipelines
ITEM_PIPELINES = {
'reddit_scraper.pipelines.RedditScraperPipeline': 300,
}
# Enable and configure the AutoThrottle extension (disabled by default)
AUTOTHROTTLE_ENABLED = True
AUTOTHROTTLE_START_DELAY = 5
AUTOTHROTTLE_MAX_DELAY = 60
AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
AUTOTHROTTLE_DEBUG = False
# Enable showing throttling stats for every response received:
AUTOTHROTTLE_DEBUG = False
# HTTPCACHE_ENABLED = True
# HTTPCACHE_EXPIRATION_SECS = 0
# HTTPCACHE_DIR = 'httpcache'
# HTTPCACHE_IGNORE_HTTP_CODES = []
# HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'
# OAuth 2.0 settings
OAUTH2_CLIENT_ID = 'your_client_id'
OAUTH2_CLIENT_SECRET = 'your_client_secret'
OAUTH2_REDIRECT_URI = 'http://localhost:8000/oauth2/callback'
# Facebook API settings
FACEBOOK_API_VERSION = 'v10.0'
FACEBOOK_ACCESS_TOKEN = 'your_access_token'
# Reddit API settings
REDDIT_API_VERSION = 'v1'
REDDIT_ACCESS_TOKEN = 'your_access_token'