Skip to content

Commit

Permalink
fix(requests): use self.session instead of requests (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
acostapazo authored Sep 4, 2023
1 parent 9f50a6b commit c4d5fe2
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions alice/onboarding/onboarding_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1830,7 +1830,7 @@ def request_duplicates_search(
"resource_type": resource_type.value,
}
try:
response = requests.post(
response = self.session.post(
f"{self.url}/duplicates/search",
data=data,
headers=headers,
Expand Down Expand Up @@ -1874,7 +1874,7 @@ def get_duplicates_search(
headers = self._auth_headers(backend_token)

try:
response = requests.get(
response = self.session.get(
f"{self.url}/duplicates/search/{search_id}",
headers=headers,
timeout=self.timeout,
Expand Down Expand Up @@ -1911,7 +1911,7 @@ def get_duplicates_searches(self, verbose: bool = False) -> Result[Response, Err
headers = self._auth_headers(backend_token)

try:
response = requests.get(
response = self.session.get(
f"{self.url}/duplicates/searches", headers=headers, timeout=self.timeout
)
except requests.exceptions.Timeout:
Expand Down Expand Up @@ -1950,7 +1950,7 @@ def get_user_state(

headers = self._auth_headers(backend_user_token)
try:
response = requests.get(
response = self.session.get(
f"{self.url}/user/state",
headers=headers,
timeout=self.timeout,
Expand Down Expand Up @@ -2001,7 +2001,7 @@ def update_user_state(

headers = self._auth_headers(backend_user_token)
try:
response = requests.patch(
response = self.session.patch(
f"{self.url}/user/state",
headers=headers,
json={
Expand Down Expand Up @@ -2049,7 +2049,7 @@ def retrieve_flow(
url = f"{self.url}/flow?flow_id={flow_id}"

try:
response = requests.get(
response = self.session.get(
url,
headers=headers,
timeout=self.timeout,
Expand Down Expand Up @@ -2083,7 +2083,7 @@ def retrieve_flows(self, verbose: bool = False) -> Result[Response, Error]:
headers = self._auth_headers(backend_token)

try:
response = requests.get(
response = self.session.get(
f"{self.url}/flows",
headers=headers,
timeout=self.timeout,
Expand Down Expand Up @@ -2141,7 +2141,7 @@ def create_flow(
data.update({"id": id_})

try:
response = requests.post(
response = self.session.post(
f"{self.url}/flow",
headers=headers,
json=data,
Expand Down Expand Up @@ -2198,7 +2198,7 @@ def update_flow(
}

try:
response = requests.patch(
response = self.session.patch(
f"{self.url}/flow",
headers=headers,
json=data,
Expand Down Expand Up @@ -2239,7 +2239,7 @@ def delete_flow(
headers = self._auth_headers(backend_token)

try:
response = requests.delete(
response = self.session.delete(
f"{self.url}/flow?flow_id={flow_id}",
headers=headers,
timeout=self.timeout,
Expand Down Expand Up @@ -2279,7 +2279,7 @@ def get_user_flow(
headers = self._auth_headers(backend_token)

try:
response = requests.get(
response = self.session.get(
f"{self.url}/user/flow",
headers=headers,
timeout=self.timeout,
Expand Down Expand Up @@ -2322,7 +2322,7 @@ def update_user_flow(
headers = self._auth_headers(backend_token)

try:
response = requests.patch(
response = self.session.patch(
f"{self.url}/user/flow/{flow_id}",
headers=headers,
timeout=self.timeout,
Expand Down

0 comments on commit c4d5fe2

Please sign in to comment.