]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Add flake8-pie plugin (#419)
authorStephen Brown II <Stephen.Brown2@gmail.com>
Tue, 1 Oct 2019 17:02:29 +0000 (11:02 -0600)
committerSeth Michael Larson <sethmichaellarson@gmail.com>
Tue, 1 Oct 2019 17:02:29 +0000 (12:02 -0500)
httpx/client.py
noxfile.py
test-requirements.txt
tests/dispatch/test_proxy_http.py

index d15d2c16eea5849bc568e9e7f8fca3e98970323e..bfee2de5b4df7047ef4455f1dd85d2b11c402c8b 100644 (file)
@@ -325,7 +325,7 @@ class BaseClient:
         headers = self.merge_headers(headers)
         cookies = self.merge_cookies(cookies)
         params = self.merge_queryparams(params)
-        request = AsyncRequest(
+        return AsyncRequest(
             method,
             url,
             data=data,
@@ -335,7 +335,6 @@ class BaseClient:
             headers=headers,
             cookies=cookies,
         )
-        return request
 
 
 class AsyncClient(BaseClient):
@@ -718,7 +717,7 @@ class Client(BaseClient):
             headers=headers,
             cookies=cookies,
         )
-        response = self.send(
+        return self.send(
             request,
             stream=stream,
             auth=auth,
@@ -728,7 +727,6 @@ class Client(BaseClient):
             timeout=timeout,
             trust_env=trust_env,
         )
-        return response
 
     def send(
         self,
index c7ada4fb9ea233cc4d7653520f4c38a14bd940d7..747e30ef6b5fa3072d35afa49f106928a22cb56c 100644 (file)
@@ -20,7 +20,13 @@ def lint(session):
 @nox.session(reuse_venv=True)
 def check(session):
     session.install(
-        "black", "flake8", "flake8-bugbear", "flake8-comprehensions", "isort", "mypy"
+        "black",
+        "flake8",
+        "flake8-bugbear",
+        "flake8-comprehensions",
+        "flake8-pie",
+        "isort",
+        "mypy",
     )
 
     session.run("black", "--check", "--diff", "--target-version=py36", *source_files)
index fb176cabe19ae8da12d18d51fbdd010fd89c8efd..be06182e926a9411346bc976e0ffa3a2d0fdb3c7 100644 (file)
@@ -7,6 +7,7 @@ cryptography
 flake8
 flake8-bugbear
 flake8-comprehensions
+flake8-pie
 isort
 mypy
 pytest
index 2d93871565e0602e0ef7423cacafc5bc1309865a..4776a8d2cf3e4fb6cc617ab5e6732a2f16772bd2 100644 (file)
@@ -26,7 +26,7 @@ async def test_proxy_tunnel_success(backend):
         backend=raw_io,
         proxy_mode=httpx.HTTPProxyMode.TUNNEL_ONLY,
     ) as proxy:
-        response = await proxy.request("GET", f"http://example.com")
+        response = await proxy.request("GET", "http://example.com")
 
         assert response.status_code == 404
         assert response.headers["Server"] == "origin-server"
@@ -64,7 +64,7 @@ async def test_proxy_tunnel_non_2xx_response(backend, status_code):
             backend=raw_io,
             proxy_mode=httpx.HTTPProxyMode.TUNNEL_ONLY,
         ) as proxy:
-            await proxy.request("GET", f"http://example.com")
+            await proxy.request("GET", "http://example.com")
 
     # ProxyError.request should be the CONNECT request not the original request
     assert e.value.request.method == "CONNECT"
@@ -116,7 +116,7 @@ async def test_proxy_tunnel_start_tls(backend):
         backend=raw_io,
         proxy_mode=httpx.HTTPProxyMode.TUNNEL_ONLY,
     ) as proxy:
-        resp = await proxy.request("GET", f"https://example.com")
+        resp = await proxy.request("GET", "https://example.com")
 
         assert resp.status_code == 404
         assert resp.headers["Server"] == "origin-server"
@@ -128,7 +128,7 @@ async def test_proxy_tunnel_start_tls(backend):
         await resp.read()
 
         # Make another request to see that the tunnel is re-used.
-        resp = await proxy.request("GET", f"https://example.com/target")
+        resp = await proxy.request("GET", "https://example.com/target")
 
         assert resp.status_code == 200
         assert resp.headers["Server"] == "origin-server"
@@ -172,7 +172,7 @@ async def test_proxy_forwarding(backend, proxy_mode):
         proxy_headers={"Proxy-Authorization": "test", "Override": "2"},
     ) as proxy:
         response = await proxy.request(
-            "GET", f"http://example.com", headers={"override": "1"}
+            "GET", "http://example.com", headers={"override": "1"}
         )
 
         assert response.status_code == 200