-
-
Notifications
You must be signed in to change notification settings - Fork 611
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: move `HTTP_VERBS`/`HTTPX_ATTRS` to `core.utils` * perf(core): use sets for `HTTP_REQUEST_VERBS`/`HTTPX_ATTRS` * feat(plugins): add support for `httpx` in `B113` * refactor: put back `HTTP_VERBS`/`HTTPX_ATTRS` into plugins * Update bandit/plugins/request_without_timeout.py * Update bandit/plugins/request_without_timeout.py * Update bandit/plugins/request_without_timeout.py --------- Co-authored-by: Eric Brown <[email protected]>
- Loading branch information
1 parent
a670e03
commit 67ba251
Showing
5 changed files
with
93 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,68 @@ | ||
import httpx | ||
import requests | ||
import not_requests | ||
|
||
# Errors | ||
requests.get('https://gmail.com') | ||
requests.get('https://gmail.com', timeout=None) | ||
requests.get('https://gmail.com', timeout=5) | ||
requests.post('https://gmail.com') | ||
requests.post('https://gmail.com', timeout=None) | ||
requests.post('https://gmail.com', timeout=5) | ||
requests.put('https://gmail.com') | ||
requests.put('https://gmail.com', timeout=None) | ||
requests.put('https://gmail.com', timeout=5) | ||
requests.delete('https://gmail.com') | ||
requests.delete('https://gmail.com', timeout=None) | ||
requests.delete('https://gmail.com', timeout=5) | ||
requests.patch('https://gmail.com') | ||
requests.patch('https://gmail.com', timeout=None) | ||
requests.patch('https://gmail.com', timeout=5) | ||
requests.options('https://gmail.com') | ||
requests.options('https://gmail.com', timeout=None) | ||
requests.options('https://gmail.com', timeout=5) | ||
requests.head('https://gmail.com') | ||
requests.head('https://gmail.com', timeout=None) | ||
requests.head('https://gmail.com', timeout=5) | ||
httpx.get('https://gmail.com') | ||
httpx.get('https://gmail.com', timeout=None) | ||
httpx.post('https://gmail.com') | ||
httpx.post('https://gmail.com', timeout=None) | ||
httpx.put('https://gmail.com') | ||
httpx.put('https://gmail.com', timeout=None) | ||
httpx.delete('https://gmail.com') | ||
httpx.delete('https://gmail.com', timeout=None) | ||
httpx.patch('https://gmail.com') | ||
httpx.patch('https://gmail.com', timeout=None) | ||
httpx.options('https://gmail.com') | ||
httpx.options('https://gmail.com', timeout=None) | ||
httpx.head('https://gmail.com') | ||
httpx.head('https://gmail.com', timeout=None) | ||
httpx.Client() | ||
httpx.Client(timeout=None) | ||
httpx.AsyncClient() | ||
httpx.AsyncClient(timeout=None) | ||
with httpx.Client() as client: | ||
client.get('https://gmail.com') | ||
with httpx.Client(timeout=None) as client: | ||
client.get('https://gmail.com') | ||
async with httpx.AsyncClient() as client: | ||
await client.get('https://gmail.com') | ||
async with httpx.AsyncClient(timeout=None) as client: | ||
await client.get('https://gmail.com') | ||
|
||
# Okay | ||
not_requests.get('https://gmail.com') | ||
requests.get('https://gmail.com', timeout=5) | ||
requests.post('https://gmail.com', timeout=5) | ||
requests.put('https://gmail.com', timeout=5) | ||
requests.delete('https://gmail.com', timeout=5) | ||
requests.patch('https://gmail.com', timeout=5) | ||
requests.options('https://gmail.com', timeout=5) | ||
requests.head('https://gmail.com', timeout=5) | ||
httpx.get('https://gmail.com', timeout=5) | ||
httpx.post('https://gmail.com', timeout=5) | ||
httpx.put('https://gmail.com', timeout=5) | ||
httpx.delete('https://gmail.com', timeout=5) | ||
httpx.patch('https://gmail.com', timeout=5) | ||
httpx.options('https://gmail.com', timeout=5) | ||
httpx.head('https://gmail.com', timeout=5) | ||
httpx.Client(timeout=5) | ||
httpx.AsyncClient(timeout=5) | ||
with httpx.Client(timeout=5) as client: | ||
client.get('https://gmail.com') | ||
async with httpx.AsyncClient(timeout=5) as client: | ||
await client.get('https://gmail.com') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters