The Smoking Gun
This is a python library that has basic tools for log capturing.
Installation
pip install smoking-gun
Example
import logging
import sys
import requests
from smoking_gun.logs import CapturedLogging
log_format = '[%(asctime)s][%(levelname)s][%(name)s] %(message)s'
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG, format=log_format)
response = requests.get('http://github.com', allow_redirects=True)
# sample output:
# [2020-01-08 02:35:10,467][DEBUG][urllib3.connectionpool] Starting new HTTP connection (1): github.com:80
# [2020-01-08 02:35:11,023][DEBUG][urllib3.connectionpool] http://github.com:80 "GET / HTTP/1.1" 301 0
# [2020-01-08 02:35:11,027][DEBUG][urllib3.connectionpool] Starting new HTTPS connection (1): github.com:443
# [2020-01-08 02:35:11,938][DEBUG][urllib3.connectionpool] https://github.com:443 "GET / HTTP/1.1" 200 None
with CapturedLogging() as cl:
response = requests.get('http://github.com', allow_redirects=True)
# no output
print(cl.logs)
# [2020-01-08 02:35:10,467][DEBUG][urllib3.connectionpool] Starting new HTTP connection (1): github.com:80
# [2020-01-08 02:35:11,023][DEBUG][urllib3.connectionpool] http://github.com:80 "GET / HTTP/1.1" 301 0
# [2020-01-08 02:35:11,027][DEBUG][urllib3.connectionpool] Starting new HTTPS connection (1): github.com:443
# [2020-01-08 02:35:11,938][DEBUG][urllib3.connectionpool] https://github.com:443 "GET / HTTP/1.1" 200 None
Metadata
Release files for smoking-gun 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| smoking_gun-1.0.2.tar.gz | 3.8 kB | Without provenance | Details for smoking_gun-1.0.2.tar.gz |
Release files / smoking_gun-1.0.2.tar.gz
| Download URL | smoking_gun-1.0.2.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dda4bcc0573fc16ae12e030add8eece89bcfb43c82186b9afe3e0272aa4b39a5
|
|
BLAKE2b-256 checksum How to use checksums |
b25a9c2b8c5adeb9f839e9fd7c3ff34348572281dcb8d04d4ebe554370c5e57b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/2.7.15
|
Security for smoking-gun 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.