|
@@ -188,17 +188,19 @@ def jsonToOrderTicket(jsonstring) -> OrderTicket:
|
|
|
|
|
|
#Функция обращения к апи и получение токена
|
|
|
def requestGetToken(login, password, url) -> str:
|
|
|
- #login = "79876543210"
|
|
|
- #password = "admin12345@"
|
|
|
+ login = "11111111111"
|
|
|
+ password = "Sharix!"
|
|
|
#url = "https://user.sharix-app.org/auth/token/login/"
|
|
|
data = {
|
|
|
- "password": password,
|
|
|
- "phone_number": login
|
|
|
+ "password":password,
|
|
|
+ "phone_number":login
|
|
|
}
|
|
|
- response = requests.post(url, json=data)
|
|
|
+ response = requests.post(url,json=data)
|
|
|
result = response.json()
|
|
|
return result['auth_token']
|
|
|
#Функция обращения к апи и получение токена
|
|
|
+
|
|
|
+
|
|
|
def createUser(username, phone, password, url) -> str:
|
|
|
data = {
|
|
|
"username": username,
|
|
@@ -209,6 +211,8 @@ def createUser(username, phone, password, url) -> str:
|
|
|
result = response.json()
|
|
|
return result
|
|
|
#Функция обращения к апи и получение списка пользователей
|
|
|
+
|
|
|
+
|
|
|
def requestGetListUser():
|
|
|
auth_token=requestGetToken()
|
|
|
print(auth_token)
|
|
@@ -220,15 +224,9 @@ def requestGetListUser():
|
|
|
|
|
|
|
|
|
def requestGetList(auth_token, url):
|
|
|
- #auth_token=requestGetToken(login, password, url)
|
|
|
- #print(auth_token)
|
|
|
headers = {'Authorization': f'Token {auth_token}'}
|
|
|
- #url = 'https://user.sharix-app.org/platform/api/sharix-users/'
|
|
|
- response = requests.get(config.API_URL+"/tickets/api/tickets/?list_id=10", headers=headers)
|
|
|
+ response = requests.get(url, headers=headers)
|
|
|
#response = requests.get(config.API_URL+"/metaservicesynced/api/orders/", headers=headers)
|
|
|
- print(response)
|
|
|
- #return response.json()
|
|
|
- print(response.json())
|
|
|
ordertext=response.json()
|
|
|
startlist = []
|
|
|
|
|
@@ -244,19 +242,5 @@ def requestGetList(auth_token, url):
|
|
|
except Exception as ex:
|
|
|
print(ex)
|
|
|
print (startlist)
|
|
|
- #if ordertext is not None:
|
|
|
- # for order in ordertext:
|
|
|
- # print (order)
|
|
|
- # strorder = str(order).replace("'", '"')
|
|
|
- # strorder = strorder.replace("None", 'null')
|
|
|
- # #parsed_json = ast.literal_eval(order)
|
|
|
- # #print (parsed_json)
|
|
|
- # orderObj = jsonToOrderTicket(strorder)
|
|
|
- # print (orderObj)
|
|
|
- # startlist.append(orderObj)
|
|
|
- # #bot.bot_log(str(datetime.now())+"Заказ успешно добавлен в очередь обработки\n")
|
|
|
-
|
|
|
-
|
|
|
- #print (orderticket)
|
|
|
return startlist
|
|
|
|