Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(requests): use self.session instead of requests #81

Merged
merged 1 commit into from
Sep 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading