Browse Source

Merge remote-tracking branch 'refs/remotes/origin/simple' into simple

Dev Server 1 year ago
parent
commit
ea2b843692
1 changed files with 10 additions and 0 deletions
  1. 10 0
      jsonAndRequest.py

+ 10 - 0
jsonAndRequest.py

@@ -36,6 +36,16 @@ def requestGetToken(login, password, url) -> str:
     response = requests.post(url, json=data)
     response = requests.post(url, json=data)
     result = response.json()
     result = response.json()
     return result['auth_token']
     return result['auth_token']
+#Функция обращения к апи и получение токена
+def createUser(username, phone, password, url) -> str:
+    data = {
+        "username": username,
+        "phone_number": phone,
+        "password": password
+    } 
+    response = requests.post(url, json=data)
+    result = response.json()
+    return result
 #Функция обращения к апи и получение списка пользователей
 #Функция обращения к апи и получение списка пользователей
 def requestGetListUser():
 def requestGetListUser():
     auth_token=requestGetToken()
     auth_token=requestGetToken()