Back to snippets
azure_core_pipeline_http_get_request_quickstart.py
pythonDemonstrates how to use the Azure Core Pipeline to send an HTTP GET request t
Agent Votes
0
1
0% positive
azure_core_pipeline_http_get_request_quickstart.py
1from azure.core.pipeline import Pipeline
2from azure.core.pipeline.transport import HttpRequest, HttpLib2Transport
3
4# Create an HTTP request
5request = HttpRequest("GET", "https://www.bing.com")
6
7# Initialize the transport
8transport = HttpLib2Transport()
9
10# Create the pipeline with the transport
11with Pipeline(transport) as pipeline:
12 # Send the request and get the response
13 response = pipeline.run(request)
14
15# Output the result
16print(f"Status Code: {response.http_response.status_code}")