curl -I python one liner

I didn't have curl in an ancient environment, but I had python.

$ python -c "import urllib2;r=urllib2.urlopen('http://www.python.org');print r.info();"
Server: nginx
Content-Type: text/html; charset=utf-8
X-Frame-Options: SAMEORIGIN
X-Clacks-Overhead: GNU Terry Pratchett
Content-Length: 47424
Accept-Ranges: bytes
Date: Tue, 27 Sep 2016 11:07:15 GMT
Via: 1.1 varnish
Age: 2297
Connection: close
X-Served-By: cache-sin6921-SIN
X-Cache: HIT
X-Cache-Hits: 10
Vary: Cookie
Public-Key-Pins: hogehoge

$

Reference: 20.6. Urllib2 — extensible library for opening URLs — Python 2.7.x documentation

Maybe this one is a little older?

$ python -c "import httplib;conn = httplib.HTTPSConnection('www.python.org');conn.request('GET','/');r1 = conn.getresponse();print r1.status, r1.reason"
200 OK

$

Reference: 20.7. httplib — HTTP Protocol Client — Python 2.7.x Documentation

If you look for http with one liner in python, you are a person who builds a web server below, so no, there is no one liner that is http get.

$ python -m SimpleHTTPServer 800

Reference: 20.19. SimpleHTTPServer — Concise HTTP Request Handler — Python 2.7.x Documentation

Does it contain perl in the first place? If so, it looks like the following. Well, if there is a module.

$ perl -MLWP::Simple -le'print get shift' http://www.dan.co.jp/

Reference: Leave one-liner to perl

wget? You don't know.

that's all.

Recommended Posts

curl -I python one liner
One liner in Python
python Zundko One Liner
I started python
One liner webServer (with CGI) in python
I wrote Project Euler 1 in one liner.
One liner that outputs multiplication tables in Python
One liner to 100% CPU1 core usage in Python
I tried Python> autopep8
I implemented Python Logging
One Liner Web Server
Relearn Python (Algorithm I)
String shuffle one liner
One Liner Zundco Check
I tried Python> decorator
Why I chose Python
I compared Python more-itertools 2.5 → 2.6
One liner that outputs 1000000 digits of pi in Python
I tried fp-growth with python
One liner to talk somewhere
I wrote python in Japanese
Fizzbuzz in Python (in one line)
I made blackjack with python!
DMD in Python one dimension
I compared Java and Python!
5 reasons I got into Python
I tried Python C extension
[Python] I tried using OpenPose
I made a python text
I ran python on windows
I tried gRPC with Python
I tried scraping with python
I understand Python in Japanese!
[Python] DI (Dependency Injection) container Which one should I use?
I made blackjack with Python.
What I learned in Python
I learned Python basic grammar
I made wordcloud with Python.
I downloaded the python source
Make python segfault in one line
I made a Line-bot using Python!
I tried to touch Python (installation)
I can't install python3 with pyenv-vertualenv
I checked Mac Python environment construction
I tried web scraping with python.
I can't remember Python regular expressions
I made my own Python library
Notation I encountered while learning Python
[Python] I implemented peripheral Gibbs sampling
I made a fortune with Python.
I sent an SMS with Python
[Python beginner] Divide one list (5 lines).
I wrote Fizz Buzz in Python
I took Progete's Python Learning Course I
I tried using Thonny (Python / IDE)
I tried Grumpy (Go running Python).
I liked the tweet with python. ..
I learned about processes in Python
I can't install scikit-learn in Python
I played with PyQt5 and Python3
I wrote the queue in Python