def send_notification(self, username, title, body, data):
     request_body = {
         "username": username,
         "notification": {
             "title": title,
             "body": body,
             "data": data
         }
     }
     response = requests.post(f'{self.url}/notifications', json=request_body)
     return make_flask_response(response)
Пример #2
0
 def get_user_videos(self, user_id, search):
     query = "?user_id={}&visibility=public".format(user_id)
     for k,v in search.items(): query+= "&{}={}".format(k,v)
     response = requests.get('{}/videos{}'.format(self.url, query))
     return make_flask_response(response)
Пример #3
0
 def get_videos(self):
     response = requests.get(self.url + '/videos?is_blocked=false')
     return make_flask_response(response)
Пример #4
0
 def add_video(self, data):
     response = requests.post(self.url + '/videos', json=data)
     return make_flask_response(response)
Пример #5
0
 def validate_code(self, code, email):
     response = requests.get(
         f'{self.url}/users/password?code={code}&email={email}',
         headers=self._headers())
     return make_flask_response(response)
Пример #6
0
 def change_password(self, body, code, email):
     response = requests.post(
         f'{self.url}/users/password?code={code}&email={email}',
         json=body,
         headers=self._headers())
     return make_flask_response(response)
Пример #7
0
 def delete_user_profile(self, user_id):
     response = requests.delete(f'{self.url}/users/{user_id}',
                                headers=self._headers())
     return make_flask_response(response)
Пример #8
0
 def oauth_login(self, body):
     response = requests.post(self.url + '/users/oauth2login',
                              json=body,
                              headers=self._headers())
     return make_flask_response(response)
Пример #9
0
 def get_user_profile(self, user_id_request):
     response = requests.get(f'{self.url}/users/{user_id_request}',
                             headers=self._headers())
     return make_flask_response(response)
Пример #10
0
 def edit_user_profile(self, user_id, body):
     response = requests.put(f'{self.url}/users/{user_id}',
                             json=body,
                             headers=self._headers())
     return make_flask_response(response)
Пример #11
0
 def authorize_user(self, token):
     headers = {'access-token': token}
     response = requests.post(f'{self.url}/users/authorize',
                              headers=self._headers(headers))
     return make_flask_response(response)
Пример #12
0
 def get_users(self):
     response = requests.get(f'{self.url}/users', headers=self._headers())
     return make_flask_response(response)
Пример #13
0
 def register(self, body):
     response = requests.post(f'{self.url}/users/register',
                              json=body,
                              headers=self._headers())
     return make_flask_response(response)
Пример #14
0
 def delete_video(self, video_id):
     response = requests.delete('{}/videos/{}'.format(self.url, video_id))
     return make_flask_response(response)
Пример #15
0
 def send_mail(self, body):
     response = requests.post(f'{self.url}/users/reset_password',
                              json=body,
                              headers=self._headers())
     return make_flask_response(response)
Пример #16
0
 def edit_video(self, video_id, data):
     response = requests.put('{}/videos/{}'.format(self.url, video_id), json=data)
     return make_flask_response(response)
Пример #17
0
 def login(self, body):
     response = requests.post(f'{self.url}/users/login',
                              json=body,
                              headers=self._headers())
     return make_flask_response(response)