Skip to content

Commit

Permalink
Moved request headers to request_parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeusina committed Aug 9, 2023
1 parent 81817ed commit c6326a0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 2 additions & 7 deletions petersbugredu_wrap/client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
import logging
import requests
from petersbugredu_wrap.utils import endpoints
from petersbugredu_wrap.utils import endpoints, request_parameters
from petersbugredu_wrap.errors.invalid_login_or_password_exc import InvalidLoginOrPasswordException
from petersbugredu_wrap.types.child import Child

Expand Down Expand Up @@ -31,12 +31,7 @@ def login(self, login: str, password: str) -> None:
payload = (
'{"type": "email", "login": "%login%", "activation_code": null, "password": "%password%", "_isEmpty": '
'false}'.replace("%login%", login).replace("%password%", password))
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/114.0.0.0 Safari/537.36',
'Accept': 'application/json, text/plain, */*',
'Content-Type': 'application/json'
}
headers = request_parameters.headers
self.logger.debug("Sending login request as %login%".replace("%login%", login))
response = requests.request("POST", url, headers=headers, data=payload)
self.logger.debug(
Expand Down
6 changes: 6 additions & 0 deletions petersbugredu_wrap/utils/request_parameters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/114.0.0.0 Safari/537.36',
'Accept': 'application/json, text/plain, */*',
'Content-Type': 'application/json'
}

0 comments on commit c6326a0

Please sign in to comment.