reorx / httpstat Goto Github PK
View Code? Open in Web Editor NEWcurl statistics made simple
License: MIT License
curl statistics made simple
License: MIT License
Trying to run httpstat https://google.com
on Windows 7 with Python 3.6.0, results a stack trace:
Traceback (most recent call last):
File "C:\Users\me\AppData\Local\Programs\Python\Python36\Scripts\httpstat-script.py", line 11, in <module>
load_entry_point('httpstat==1.2.1', 'console_scripts', 'httpstat')()
File "c:\users\me\appdata\local\programs\python\python36\lib\site-packages\httpstat.py", line 221, in main
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=cmd_env)
File "c:\users\me\appdata\local\programs\python\python36\lib\subprocess.py", line 707, in __init__
restore_signals, start_new_session)
File "c:\users\me\appdata\local\programs\python\python36\lib\subprocess.py", line 990, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
Currently, the app stores the response body in tmp.
The new flag to support quick scan to look for metrics but not interested in keeping any output around.
This would be a great feature.
It would be even better if it does all operations in memory instead of using temp files and deleting them later.
python httpstat.py httpbin.org/get
File "httpstat.py", line 110
grayscale = {(i - 232): make_color('38;5;' + str(i)) for i in xrange(232, 256)}
^
SyntaxError: invalid syntax
Redhat 6.5, Python 2.6
An invocation that would be valid with cURL:
curl -X GET http://www.google.de/
gives the following error with httpstat:
$ httpstat -X GET http://www.google.de/
> curl -w <output-format> -D <tempfile> -o <tempfile> -s -S GET http://www.google.de/ -X
curl error: curl: option -X: requires parameter
curl: try 'curl --help' or 'curl --manual' for more information
whereas the command
httpstat http://www.google.de/ -X GET
is parsed successfully.
It would be nice if httpstat
did not depend on the position of the URL. In my concrete example, the cURL command was generated by Flask-RESTPlus Swagger documentation.
Current version:
$ curl --version
curl 7.43.0 (x86_64-apple-darwin15.0) libcurl/7.43.0 SecureTransport zlib/1.2.5
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz UnixSockets
Upgrade using brew install --build-from-source curl --with-nghttp2
(hint from https://simonecarletti.com/blog/2016/01/http2-curl-macosx/)
Testing process will be logged here.
This is a feature req. that I just thought of. I've been doing some testing of proxy servers and have used to httpstat to gain insight into how long each part of the connection process takes. To make httpstat even more adept to performance based testing like this, it would be exceptionally awesome if it had the option for making x number of requests over y timeframe and providing those results in a similar drawing to how it currently does i.e. TLS Handshake avg, Server Processing avg, etc..
Just a thought ;)
RT
Windows 7 64-bit, Python 2.7.12 64-bit
C:\Users\xmr\Desktop>curl --version
curl 7.50.1 (x86_64-pc-win32) libcurl/7.50.1 OpenSSL/1.0.2h zlib/1.2.8 WinIDN libssh2/1.7.0 nghttp2/1.13.0
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL libz TLS-SRP HTTP2
C:\Users\xmr\Desktop>httpstat google.com
←[38;5;248m←[0m
←[33mCould not decode json: Expecting property name: line 2 column 22 (char 24)←
[0m
curl result: 0 ←[38;5;248m{
"time_namelookup": 0,110,
"time_connect": 0,328,
"time_appconnect": 0,000,
"time_pretransfer": 0,328,
"time_redirect": 0,000,
"time_starttransfer": 0,391,
"time_total": 0,391,
"speed_download": 659,000,
"speed_upload": 0,000
}←[0m ←[38;5;248m←[0m
This would be super useful to have for learning more about the certificate a particular site uses. It could be an add-on option (not default) which shows issuer information, if its valid, start/expire, and possibly other details.
Just an idea!
curl 7.61.1 (x86_64-redhat-linux-gnu) libcurl/7.61.1 OpenSSL/1.1.1c zlib/1.2.11 brotli/1.0.6 libidn2/2.2.0 libpsl/0.20.2 (+libidn2/2.0.5) libssh/0.9.0/openssl/zlib nghttp2/1.33.0
export HTTPSTAT_SHOW_IP=true
export HTTPSTAT_SHOW_SPEED=true
export HTTPSTAT_SAVE_BODY=false
export HTTPSTAT_DEBUG=false
Connected to ::1:8094 from ::1:57934
HTTP/1.1 100 Continue
HTTP/1.1 200 OK
Content-Type: application/json
Grpc-Metadata-Content-Type: application/grpc
Date: Tue, 31 Aug 2021 12:33:30 GMT
Content-Length: 258
DNS Lookup TCP Connection Server Processing Content Transfer
[ 0ms | 0ms | 0ms | 1405ms ]
| | | |
namelookup:0ms | | |
connect:0ms | |
starttransfer:0ms |
total:1405ms
speed_download: 0.2 KiB/s, speed_upload: 36791.2 KiB/s
Body stored in: /var/folders/fh/5k0fl9xd06xgflnp5d90dz8m0000gn/T/tmpjIYObb
DNS Lookup TCP Connection TLS Handshake Server Processing Content Transfer
[ 2ms | 194ms | 92ms | -288ms | 1255ms ]
| | | | |
namelookup:2ms | | | |
connect:196ms | | |
pretransfer:288ms | |
starttransfer:0ms |
total:1255ms
I am a user of httpstat and I used httpstat as an example to show how to package software as snaps (https://www.ubuntu.com/desktop/snappy).
To make a snap for a software package, you need to create a snapcraft.yaml configuration file.
Here is the one for httpstat: https://gist.github.com/simos/3214bbd2f7d4a4647918bdb2afb926cd
How to create the snap?
I wrote an article about all this at https://blog.simos.info/how-to-create-a-snap-for-a-python-app-with-networking-using-snapcraft-in-ubuntu-16-04/
I understand that someone would simply need to grab the .py file and run it. I am posting this issue to inform that I have used "httpstat" as an example for my tutorial.
看这个https://github.com/davecheney/httpstat 库的时候,它的readme里有这样一句
But seriously, https://github.com/reorx/httpstat is the new hotness, and this is a shameless rip off.
就好奇问问
Will there be a release on Homebrew? httpstat
is available, too.
Add:
extras_require = {
':sys_platform=="win32"': ['colorama']
}
in setup.py
; in code, add:
https://github.com/Qix-/better-exceptions/blob/master/better_exceptions/color.py#L53
part.
First off Great software !
and the screenshot looks pretty awesome too can you please tell how can I modify my terminal to get that black window bar and that awesome font! I am on macOS.
Thanks! 😄
Hi! I receive following error on OSX:
➜ ~ httpstat https://google.com/
Could not decode json: Expecting property name: line 2 column 22 (char 23)
curl result: 0 {
"time_namelookup": 0,068,
"time_connect": 0,113,
"time_appconnect": 0,302,
"time_pretransfer": 0,302,
"time_redirect": 0,000,
"time_starttransfer": 0,370,
"time_total": 0,370,
"speed_download": 594,000,
"speed_upload": 0,000
}
I think, the problem is in number format, it uses a comma instead of dot as a delimiter.
Hi there,
First thanks for your really awesome tool, my problem with this is that I installed it with pip
on ubuntu but my problem is that although I it is installed in the ~/.local/lib/python2.7/site-packages
but it isn't available via commandline. I mean when I type httpstat
it says command not found
.
Error: No available formula with the name "httpstat"
Installed via PIP on two separate computers running Windows 10 with Python 3.5.2 and Python 3.5.0 and attempted httpstat google.com
in the command line and received 'failed to create process'. Navigated directly in the command line to the default Python scripts folder and ran py httpstat-script.py google.com
and received the following on both machines:
Traceback (most recent call last): File ".\httpstat-script.py", line 9, in <module> load_entry_point('httpstat==1.2.1', 'console_scripts', 'httpstat')() File "c:\users\%NAME%\appdata\local\programs\python\python35\lib\site-packages\httpstat.py", line 221, in main p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=cmd_env) File "c:\users\%NAME%\appdata\local\programs\python\python35\lib\subprocess.py", line 947, in __init__ restore_signals, start_new_session) File "c:\users\%NAME%\appdata\local\programs\python\python35\lib\subprocess.py", line 1224, in _execute_child startupinfo) FileNotFoundError: [WinError 2] The system cannot find the file specified
Ran repair on my Python installation and retried. Uninstalled and reinstalled Python (using elevated privileges) and retried. No positive effect.
An attempt on a third Win10 computer with both Python 3.5.1 and Python 2.7 installed worked without issue. Installed via PIP and httpstat google.com
ran correctly. Running the script directly on that machine with either version of Python also works without issue.
Cool program! Did you consider merging with httpie, maybe behind a cli flag?
Is this something that could be added?
I have a networking solution which probes the destination with http, mtr, ping etc and collect metrics. Often I see when MTR, Ping return 100% packet loss, httpstat report a very large value of latency. Is it possible to put a time out in the code (preferably configurable) ?
It would be nice to find out the exact IP that was used to make the connection. This helps for things like debugging round-robin records etc..
Maybe something like HTTPSTAT_SHOW_IP
Great work on this btw, definitely my go to utility now ;)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.