Created
April 18, 2022 10:06
-
-
Save gabrieleromanato/28f719150d46a549572db83e9cbcb5d2 to your computer and use it in GitHub Desktop.
Cloudflare: get HTTP headers of a given domain/URL
This file contains hidden or 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
import requests | |
import validators | |
from validators import ValidationFailure | |
class CloudflareRequest: | |
def __init__(self, url): | |
self.url = url | |
def send(self): | |
valid_url = validators.url(self.url.strip()) | |
if isinstance(valid_url, ValidationFailure): | |
return False | |
r = requests.get(self.url, allow_redirects=True) | |
return r.headers |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment