You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 KiB
11 KiB
<html>
<head>
</head>
</html>
In [1]:
# Retrieve Decumentation
!curl -fLvo readme.md https://raw.githubusercontent.com/gruns/furl/master/README.md
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying 185.199.109.133:443...
* Connected to raw.githubusercontent.com (185.199.109.133) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* CAfile: /etc/ssl/certs/ca-certificates.crt
* CApath: /etc/ssl/certs
* TLSv1.0 (OUT), TLS header, Certificate Status (22):
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.2 (IN), TLS header, Certificate Status (22):
{ [5 bytes data]
* TLSv1.3 (IN), TLS handshake, Server hello (2):
{ [122 bytes data]
* TLSv1.2 (IN), TLS header, Finished (20):
{ [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
{ [19 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.3 (IN), TLS handshake, Certificate (11):
{ [3051 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
{ [264 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.3 (IN), TLS handshake, Finished (20):
{ [52 bytes data]
* TLSv1.2 (OUT), TLS header, Finished (20):
} [5 bytes data]
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Finished (20):
} [52 bytes data]
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server accepted to use h2
* Server certificate:
* subject: C=US; ST=California; L=San Francisco; O=GitHub, Inc.; CN=*.github.io
* start date: Mar 18 00:00:00 2022 GMT
* expire date: Mar 21 23:59:59 2023 GMT
* subjectAltName: host "raw.githubusercontent.com" matched cert's "*.githubusercontent.com"
* issuer: C=US; O=DigiCert Inc; CN=DigiCert TLS RSA SHA256 2020 CA1
* SSL certificate verify ok.
* Using HTTP2, server supports multiplexing
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
} [5 bytes data]
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
} [5 bytes data]
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
} [5 bytes data]
* Using Stream ID: 1 (easy handle 0x559fdfac8e80)
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
} [5 bytes data]
> GET /gruns/furl/master/README.md HTTP/2
> Host: raw.githubusercontent.com
> user-agent: curl/7.81.0
> accept: */*
>
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
{ [193 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
} [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
< HTTP/2 200
< cache-control: max-age=300
< content-security-policy: default-src 'none'; style-src 'unsafe-inline'; sandbox
< content-type: text/plain; charset=utf-8
< etag: "a422674a44f080e982c2757a03c7a6085f6de3a85731442a2f14785510ef12e2"
< strict-transport-security: max-age=31536000
< x-content-type-options: nosniff
< x-frame-options: deny
< x-xss-protection: 1; mode=block
< x-github-request-id: 5F04:63F8:20E44:3B90F:62F2032B
< accept-ranges: bytes
< date: Tue, 09 Aug 2022 06:48:11 GMT
< via: 1.1 varnish
< x-served-by: cache-iah17220-IAH
< x-cache: MISS
< x-cache-hits: 0
< x-timer: S1660027691.995129,VS0,VE126
< vary: Authorization,Accept-Encoding,Origin
< access-control-allow-origin: *
< x-fastly-request-id: 3ae1114575f72aef60b2af9ef7e0d60266073cbb
< expires: Tue, 09 Aug 2022 06:53:11 GMT
< source-age: 0
< content-length: 23922
<
{ [885 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
100 23922 100 23922 0 0 76972 0 --:--:-- --:--:-- --:--:-- 77167
* Connection #0 to host raw.githubusercontent.com left intact
In [2]:
%pip install furl
Defaulting to user installation because normal site-packages is not writeable Collecting furl Downloading furl-2.1.3-py2.py3-none-any.whl (20 kB) Requirement already satisfied: six>=1.8.0 in /usr/lib/python3/dist-packages (from furl) (1.16.0) Collecting orderedmultidict>=1.0.1 Downloading orderedmultidict-1.0.1-py2.py3-none-any.whl (11 kB) Installing collected packages: orderedmultidict, furl Successfully installed furl-2.1.3 orderedmultidict-1.0.1 Note: you may need to restart the kernel to use updated packages.
Function: URL Deconstructor¶
Takes a URL, chops it up into all the little pieces, returns as a JSON dictionary
In [1]:
from furl import furl
import pprint
url = 'https://github.com/gruns/furl#scheme-username-password-host-port-network-location-and-origin'
f = furl(url)
result = f.asdict()
pprint.pprint(result)
{'fragment': {'encoded': 'scheme-username-password-host-port-network-location-and-origin',
'path': {'encoded': 'scheme-username-password-host-port-network-location-and-origin',
'isabsolute': False,
'isdir': False,
'isfile': True,
'segments': ['scheme-username-password-host-port-network-location-and-origin']},
'query': {'encoded': '', 'params': []},
'separator': True},
'host': 'github.com',
'host_encoded': 'github.com',
'netloc': 'github.com',
'origin': 'https://github.com',
'password': None,
'path': {'encoded': '/gruns/furl',
'isabsolute': True,
'isdir': False,
'isfile': True,
'segments': ['gruns', 'furl']},
'port': 443,
'query': {'encoded': '', 'params': []},
'scheme': 'https',
'url': 'https://github.com/gruns/furl#scheme-username-password-host-port-network-location-and-origin',
'username': None}