init
This commit is contained in:
21
earthporn_analyzer.py
Normal file
21
earthporn_analyzer.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import requests
|
||||
import requests.auth
|
||||
import json
|
||||
CLIENT_ID = "0U8ldg0566wsdjrf7lUDlQ"
|
||||
CLIENT_SECRET = "xq7JLuAlVAWun0p_LqOfS3gyCjgN8A"
|
||||
|
||||
CODE = "code"
|
||||
URI = "uri"
|
||||
client_auth = requests.auth.HTTPBasicAuth(CLIENT_ID, CLIENT_SECRET)
|
||||
post_data = {"grant_type": "authorization_code", "code": {CODE}, "redirect_uri": {URI}}
|
||||
headers = {"User-Agent": "python:com.llamallama.earthporn_analyzer:v0.0.1 (by /u/explodingllama)"}
|
||||
response = requests.post("https://www.reddit.com/api/v1/access_token", auth=client_auth, data=post_data, headers=headers )
|
||||
print(response.json())
|
||||
response_json = response.json()
|
||||
"""
|
||||
token = response_json['access_token']
|
||||
|
||||
headers = {"Authorization": f"bearer {token}", "User-Agent": "python:com.llamallama.earthporn_analyzer:v0.0.1 (by /u/explodingllama)"}
|
||||
response = requests.get("https://oauth.reddit.com/api/v1/me", headers=headers)
|
||||
response.json()
|
||||
"""
|
||||
Reference in New Issue
Block a user