Skip to content

Instantly share code, notes, and snippets.

@mathewthe2
Created November 24, 2020 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mathewthe2/3f8c37a81130e65b762e89dfc47c6cd4 to your computer and use it in GitHub Desktop.
Save mathewthe2/3f8c37a81130e65b762e89dfc47c6cd4 to your computer and use it in GitHub Desktop.
import requests
user_auth_app_head = {
'Host': 'web.sd.lp1.acbaa.srv.nintendo.net',
'User-Agent': 'Mozilla/5.0 (Linux; Android 7.1.2; Pixel Build/NJH47D; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/59.0.3071.125 Mobile Safari/537.36',
'Accept': 'application/json, text/plain, */*',
'Connection': 'keep-alive',
'Referer': 'https://web.sd.lp1.acbaa.srv.nintendo.net/?lang=en-US&na_country=US&na_lang=en-US',
'Authorization' : 'tmp',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'en-us'
}
def sendReaction(reaction_value):
data = {
'body': reaction_value,
'type': 'emoticon'
}
res = post_AC_NSOJSON(user_auth_app_head, data, 'https://web.sd.lp1.acbaa.srv.nintendo.net/api/sd/v1/messages')
if res is not None:
if 'status' in res:
if res['status'] == 'success':
return 'Reaction sent!'
elif 'code' in res:
if res['code'] == '1001':
return 'Animal Crossing Session Not Connected'
return res
def post_AC_NSOJSON(header, body, url):
h = header
h['Authorization'] = 'Bearer ' + tokens['ac_b']
pcookie = {}
pcookie['_gtoken'] = tokens['ac_g']
pcookie['_park_session'] = tokens['ac_p']
r = requests.post(url, headers=h, cookies=pcookie, json=body)
thejson = json.loads(r.text)
return thejson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment