From eea96b6b2f04c4357e2734589e988ca0266b46a0 Mon Sep 17 00:00:00 2001 From: Zergling_man Date: Tue, 18 Oct 2022 07:54:13 +1100 Subject: [PATCH] dicking about with bash again --- api.py | 3 ++- conf.py | 2 ++ main.py | 18 ++++++++++-------- recycle1.sh | 16 ++++++++++++++++ 4 files changed, 30 insertions(+), 9 deletions(-) create mode 100644 recycle1.sh diff --git a/api.py b/api.py index b62a80a..f923ddc 100644 --- a/api.py +++ b/api.py @@ -19,7 +19,8 @@ urls['start_study']='/study/conf.php' urls['time_items']='/study/time_item.php' def get(url=None,params={},headers={},*args,**kwargs): - return r.get(urls['base']+urls[url],params={'P':conf.p}|params, headers={'User-Agent':uagent()}|headers,*args,**kwargs) + pp={'P':conf.p} if conf.p else {} + return r.get(urls['base']+urls[url],params=pp|params, headers={'User-Agent':uagent()}|headers,*args,**kwargs) def post(url,stuff,params={},headers={},*args,**kwargs): return r.post(urls['base']+urls[url], data=stuff, params={'P':conf.p}|params, headers={'User-Agent':uagent()}|headers,*args,**kwargs) diff --git a/conf.py b/conf.py index ba5a50f..4de9f56 100644 --- a/conf.py +++ b/conf.py @@ -5,6 +5,8 @@ from cryptography.hazmat.primitives.padding import PKCS7 from cryptography.hazmat.backends import default_backend backend=default_backend() +p='' + import json with open('conf.json') as b: conf=json.load(b) diff --git a/main.py b/main.py index 39edb15..4d8b246 100644 --- a/main.py +++ b/main.py @@ -1,16 +1,18 @@ import api +from dataclasses import dataclass +@dataclass class Player(): - def __init__(self): - self.id=-1 - self.name=None - self.level=0 - self.myroids=[] + id:int + name:str + level:int=0 + myroids:List(Myroid)=#[] +@dataclass class Myroid(): - self.id=-1 - self.name=None - self.outfit={} + id:int + name:str + outfit:list(Clothing)={} a=api.top() b=api.login('P-val needs adding','user','pass') diff --git a/recycle1.sh b/recycle1.sh new file mode 100644 index 0000000..61fd21a --- /dev/null +++ b/recycle1.sh @@ -0,0 +1,16 @@ +source conf.sh + +nums=$(curl -H "User-Agent: $UA" https://us-moe-app.amz-aws.jp/recycle/aimi_change_list.php?P=$p | grep -Eo '/ [0-9]