forked from transpivo/python-upvote-bot-for-reddit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnew technique.py
More file actions
30 lines (26 loc) · 781 Bytes
/
new technique.py
File metadata and controls
30 lines (26 loc) · 781 Bytes
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
import requests
requests.utils.default_user_agent = lambda: "some user agent, idk leave it like this. default one doesn't work"
def votePost(auth, postId, upvote):
headers = {
**requests.utils.default_headers(),
**{
"authorization": auth
}
}
params = {
"redditWebClient": "desktop2x",
"app": "desktop2x-client-production",
"raw_json": "1",
"gilding_detail": "1",
}
data = {
"id": postId,
"dir": "1" if upvote else "0",
"api_type": "json",
}
requests.post("https://oauth.reddit.com/api/vote", params=params, headers=headers, data=data)
votePost(
auth="IMPORTANT, PUT YOUR AUTHENTICATION HERE, AKA TOKEN HERE!",
postId="t3_17lsrb0",
upvote=False
)