Cookie dump migration
This commit is contained in:
parent
6276242260
commit
3af27f6512
@ -570,8 +570,14 @@ class BaseCitizen(access_points.CitizenAPI):
|
|||||||
with open(dump_name) as f:
|
with open(dump_name) as f:
|
||||||
data = utils.json.load(f, object_hook=utils.json_decode_object_hook)
|
data = utils.json.load(f, object_hook=utils.json_decode_object_hook)
|
||||||
player = cls(data['config']['email'], "")
|
player = cls(data['config']['email'], "")
|
||||||
|
if data.get('cookies'):
|
||||||
|
cookies = data.get('cookies')
|
||||||
|
if isinstance(cookies, list):
|
||||||
for cookie in data['cookies']:
|
for cookie in data['cookies']:
|
||||||
player._req.cookies.set(**cookie)
|
player._req.cookies.set(**cookie)
|
||||||
|
else:
|
||||||
|
player._req.cookies.update(cookies)
|
||||||
|
|
||||||
player._req.headers.update({"User-Agent": data['user_agent']})
|
player._req.headers.update({"User-Agent": data['user_agent']})
|
||||||
for k, v in data.get('config', {}).items():
|
for k, v in data.get('config', {}).items():
|
||||||
if hasattr(player.config, k):
|
if hasattr(player.config, k):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user