Skip to content
  • Sponsor TheAlgorithms/Python

  • Notifications You must be signed in to change notification settings
  • Fork 46.9k

Replace dependency requests with httpx #12732

@cclauss

Description

@cclauss

Feature description

https://pypi.org/project/requests is becoming less popular.
https://pypi.org/project/httpx is a next-generation HTTP client for Python.

Edit the file requirements.txt to remove requests and add httpx. Keep the file sorted alphabetically.

requests

Edit the file .pre-commit-config.yaml to remove additional_dependencies: [types-requests]

additional_dependencies: [types-requests]

Modify the 36 Python files that import requests to use httpx instead.

If an algorithm does multiple httpx calls, consider if the AsyncClient should be used.

Add PEP723 headers to allow the scripts to be run standalone.

+ # /// script
+ # requires-python = ">=3.13"
+ # dependencies = [
+ #     "httpx",
+ # ]
+ # ///

Activity

changed the title [-]Replace dependency requests with httpx[/-] [+]Replace dependency `requests` with `httpx`[/+] on May 12, 2025
pinned this issue on May 12, 2025
lukazlim

lukazlim commented on May 13, 2025

@lukazlim
Contributor

Hi, I would like to take this issue, by when would you like the change to be completed?

cclauss

cclauss commented on May 13, 2025

@cclauss
MemberAuthor

No rush. Take your time to do it right. We do not assign issues, so someone else might deliver a PR before yours.

lukazlim

lukazlim commented on May 13, 2025

@lukazlim
Contributor

Submitted a PR, the changes don't include web_programming/get_imdbtop.py.DISABLED which triggers algorithms-keeper to automatically close the PR

unpinned this issue on May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Replace dependency `requests` with `httpx` · Issue #12732 · TheAlgorithms/Python