Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save goatgoose/8bc68f2ec9f61fd5308eeabfb0cc42ef to your computer and use it in GitHub Desktop.
Save goatgoose/8bc68f2ec9f61fd5308eeabfb0cc42ef to your computer and use it in GitHub Desktop.
def create_get_request(route, host, user_agent):
return f"GET {route} HTTP/1.1\r\nHost: {host}\r\nUser-Agent: {user_agent}\r\n\r\n"
with open("http_request", "w") as http_request_file:
http_request_file.write(create_get_request(
"/points/39.7456,-97.0892",
"api.weather.gov",
"test-agent"
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment