From fdc7d27e0f85767d7be299a35c0ab96dcc256103 Mon Sep 17 00:00:00 2001 From: T-256 Date: Fri, 27 Sep 2024 00:12:46 +0330 Subject: [PATCH] Remove deprecated using of `data` parameter. --- CHANGELOG.md | 1 + docs/compatibility.md | 3 +-- httpx/_content.py | 14 -------------- 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25669250b5..3fee869fc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Unreleased +* The deprecated using of `data` argument now been removed. * The deprecated `proxies` argument has now been removed. * The deprecated `app` argument has now been removed. * The `URL.raw` property has now been removed. diff --git a/docs/compatibility.md b/docs/compatibility.md index e820a67b07..640f1d5ef4 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -86,8 +86,7 @@ And using `data=...` to send form data: httpx.post(..., data={"message": "Hello, world"}) ``` -Using the `data=` will raise a deprecation warning, -and is expected to be fully removed with the HTTPX 1.0 release. +Unlike `requests`, Using it as `data=` wont work. ## Upload files diff --git a/httpx/_content.py b/httpx/_content.py index 786699f38f..5d7decf095 100644 --- a/httpx/_content.py +++ b/httpx/_content.py @@ -1,7 +1,6 @@ from __future__ import annotations import inspect -import warnings from json import dumps as json_dumps from typing import ( Any, @@ -9,7 +8,6 @@ AsyncIterator, Iterable, Iterator, - Mapping, ) from urllib.parse import urlencode @@ -192,18 +190,6 @@ def encode_request( Handles encoding the given `content`, `data`, `files`, and `json`, returning a two-tuple of (, ). """ - if data is not None and not isinstance(data, Mapping): - # We prefer to separate `content=` - # for raw request content, and `data=
` for url encoded or - # multipart form content. - # - # However for compat with requests, we *do* still support - # `data=` usages. We deal with that case here, treating it - # as if `content=<...>` had been supplied instead. - message = "Use 'content=<...>' to upload raw bytes/text content." - warnings.warn(message, DeprecationWarning) - return encode_content(data) - if content is not None: return encode_content(content) elif files: