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

Update bitshortener.py #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kabilan-karthi
Copy link

In this updated version, a requests.Session object is created in the class's init method. The session's headers are set with the necessary authorization and content-type information. This session object is then used to make HTTP requests in the update_link, get_links, and user_info methods.Using the session object helps to improve efficiency by reusing the underlying TCP connection for subsequent requests to the same host. This can result in faster performance when making multiple requests to the Bit.ly API.

Incorporating a requests.Session object into the BitShortener class is a great way to make HTTP requests more efficient. This is because a Session object uses persistent HTTP connections, which is beneficial when making multiple requests to the same host, as it reduces the overhead of establishing a new connection for each request.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant