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

Refactor/SK-1225 | Use api/v1 in APIClient start_session #758

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

benjaminastrand
Copy link
Contributor

The function start_session now makes two POST requests in sequence instead of one:

  1. host_url/api/v1/sessions - to create a session
  2. host_url/api/v1/sessions/start - to start the session

The 2nd request is made only if the 1st request returns status code 201, indicating that the session has been created, and the response from the 2nd request is returned. Otherwise, the response from the 1st request is returned.

@benjaminastrand benjaminastrand changed the title Use api/v1 in APIClient start_session Refactor/SK-1225 | Use api/v1 in APIClient start_session Nov 22, 2024
@github-actions github-actions bot added the minor label Nov 22, 2024
@benjaminastrand benjaminastrand marked this pull request as draft November 22, 2024 14:20
@benjaminastrand benjaminastrand marked this pull request as ready for review November 22, 2024 14:25
@benjaminastrand benjaminastrand marked this pull request as draft November 22, 2024 14:27
Copy link
Contributor

@niklastheman niklastheman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! I left a comment.

},
verify=self.verify,
headers=self.headers,
)

if response.status_code == 201:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! An improvement could be to indicate to the user what has gone wrong if status code != 201.

@benjaminastrand benjaminastrand marked this pull request as ready for review November 22, 2024 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants