{"id":26283,"date":"2022-01-03T09:18:38","date_gmt":"2022-01-03T03:48:38","guid":{"rendered":"https:\/\/python-programs.com\/?p=26283"},"modified":"2022-01-03T09:18:38","modified_gmt":"2022-01-03T03:48:38","slug":"requests-in-python-using-python-to-request-web-pages","status":"publish","type":"post","link":"https:\/\/python-programs.com\/requests-in-python-using-python-to-request-web-pages\/","title":{"rendered":"Requests in Python: Using Python to Request Web Pages"},"content":{"rendered":"

Requests in Python is a great module that allows you to use Python to send HTTP\/1.1 requests to web pages.<\/p>\n

Python 2.7 and 3.5+ are both officially supported. Keep \u2013 Alive, Connection Pooling, Sessions with permanent cookies, and Browser Style SSL verification make it the preferred solution for developers.<\/p>\n

In this post, we’ll go over some of these features in greater detail and show you how to get started with the Python Requests module to construct web requests.<\/p>\n

Installation of Requests in Python<\/h4>\n

Installing requests in Python is simple and straightforward. There are various ways to install a module in Python. However, in this tutorial, we will demonstrate how to use it using the pip module.<\/p>\n

Open your terminal or command prompt (if you’re using Windows) and enter the following command.<\/p>\n

pip install requests \r\n#Alternatively, if the first command does not work, use the below:\r\npip3 install requests<\/pre>\n

It should have installed the requests module successfully on your device.<\/p>\n

Python Requests<\/h4>\n

To understand how the requests module works, you\u00a0must first understand what happens when you\u00a0browse the web and how it instantaneously displays the data we were hoping to see.<\/p>\n

When you click a link, we make an HTTP (Hypertext Transfer Protocol) request to the server that hosts the requested page.<\/p>\n

When the server receives the request, it returns the requested content to us.<\/p>\n

The two most useful HTTP requests are GET<\/strong> and POST<\/strong>.<\/p>\n

Importing Requests:<\/strong><\/p>\n

import requests<\/pre>\n

What is GET Request?<\/h4>\n

This approach indicates that we are requesting the contents of our chosen URL from the server. So, let’s suppose we want to retrieve Amazon’s<\/strong> homepage utilizing HTTP requests.<\/p>\n

Then Enter the below code:<\/p>\n

import requests\r\nmy_req = requests.get(\"http:\/\/amazon.com\")<\/pre>\n

What the single line of code accomplishes here?<\/p>\n

It uses the get() method to send an HTTP GET request to Amazon’s homepage, with the URL as the argument. The response object is then saved in our ‘my_req ‘ variable.<\/p>\n

Our Response object instance further classifies the retained data and saves it in the appropriate attributes.<\/p>\n

Example:<\/strong><\/p>\n

import requests\r\nmy_req = requests.get(\"http:\/\/amazon.com\")\r\n# The result contains the url's status code.\r\n# The result of a successful full attempt is 200.\r\nprint(my_req.status_code)\r\n\r\n\r\n# This attribute returns a Python dictionary containing the\r\n# headers' key-value pairs.\r\nprint(my_req.headers)\r\n\r\n# It displays the server's response content or Static Source Code.\r\nprint(my_req.text)\r\n\r\n# we could also view or modify the encoding of the response content\r\n# using the Requests library.\r\nprint(my_req.encoding)\r\nmy_req.encoding = 'utf-8'\r\n<\/pre>\n

Output:<\/strong><\/p>\n

503\r\n{'Server': 'Server', 'Content-Type': 'text\/html', 'Content-Length': '1203', 'x-amz-rid': 'T4PK7QWJPVK62Z0FZM5M', 'Last-Modified': 'Fri, 03 Dec 2021 19:33:54 GMT', 'ETag': '\"a6f-5d242fcc50c80-gzip\"', 'Accept-Ranges': 'bytes', 'Content-Encoding': 'gzip', 'Strict-Transport-Security': 'max-age=47474747; includeSubDomains; preload', 'Permissions-Policy': 'interest-cohort=()', 'Date': 'Wed, 15 Dec 2021 02:21:45 GMT', 'Connection': 'keep-alive', 'Vary': 'Accept-Encoding'}\r\n<!--\r\n        To discuss automated access to Amazon data please contact api-services-support@amazon.com.\r\n        For information about migrating to our APIs refer to our Marketplace APIs at https:\/\/developer.amazonservices.com\/ref=rm_5_sv, or our Product Advertising API at https:\/\/affiliate-program.amazon.com\/gp\/advertising\/api\/detail\/main.html\/ref=rm_5_ac for advertising use cases.\r\n-->\r\n<!doctype html>\r\n<html>\r\n<head>\r\n  <meta charset=\"utf-8\">\r\n  <meta http-equiv=\"x-ua-compatible\" content=\"ie=edge\">\r\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\">\r\n  <title>Sorry! Something went wrong!<\/title>\r\n  <style>\r\n  html, body {\r\n    padding: 0;\r\n    margin: 0\r\n  }\r\n\r\n  img {\r\n    border: 0\r\n  }\r\n\r\n  #a {\r\n    background: #232f3e;\r\n    padding: 11px 11px 11px 192px\r\n  }\r\n\r\n  #b {\r\n    position: absolute;\r\n    left: 22px;\r\n    top: 12px\r\n  }\r\n\r\n  #c {\r\n    position: relative;\r\n    max-width: 800px;\r\n    padding: 0 40px 0 0\r\n  }\r\n\r\n  #e, #f {\r\n    height: 35px;\r\n    border: 0;\r\n    font-size: 1em\r\n  }\r\n\r\n  #e {\r\n    width: 100%;\r\n    margin: 0;\r\n    padding: 0 10px;\r\n    border-radius: 4px 0 0 4px\r\n  }\r\n\r\n  #f {\r\n    cursor: pointer;\r\n    background: #febd69;\r\n    font-weight: bold;\r\n    border-radius: 0 4px 4px 0;\r\n    -webkit-appearance: none;\r\n    position: absolute;\r\n    top: 0;\r\n    right: 0;\r\n    padding: 0 12px\r\n  }\r\n\r\n  @media (max-width: 500px) {\r\n    #a {\r\n      padding: 55px 10px 10px\r\n    }\r\n\r\n    #b {\r\n      left: 6px\r\n    }\r\n  }\r\n\r\n  #g {\r\n    text-align: center;\r\n    margin: 30px 0\r\n  }\r\n\r\n  #g img {\r\n    max-width: 90%\r\n  }\r\n\r\n  #d {\r\n    display: none\r\n  }\r\n\r\n  #d[src] {\r\n    display: inline\r\n  }\r\n  <\/style>\r\n<\/head>\r\n<body>\r\n    <a href=\"\/ref=cs_503_logo\"><img id=\"b\" src=\"https:\/\/images-na.ssl-images-amazon.com\/images\/G\/01\/error\/logo._TTD_.png\" alt=\"Amazon.com\"><\/a>\r\n    <form id=\"a\" accept-charset=\"utf-8\" action=\"\/s\" method=\"GET\" role=\"search\">\r\n        <div id=\"c\">\r\n            <input id=\"e\" name=\"field-keywords\" placeholder=\"Search\">\r\n            <input name=\"ref\" type=\"hidden\" value=\"cs_503_search\">\r\n            <input id=\"f\" type=\"submit\" value=\"Go\">\r\n        <\/div>\r\n    <\/form>\r\n<div id=\"g\">\r\n  <div><a href=\"\/ref=cs_503_link\"><img src=\"https:\/\/images-na.ssl-images-amazon.com\/images\/G\/01\/error\/500_503.png\"\r\n                                        alt=\"Sorry! Something went wrong on our end. Please go back and try again or go to Amazon's home page.\"><\/a>\r\n  <\/div>\r\n  <a href=\"\/dogsofamazon\/ref=cs_503_d\" target=\"_blank\" rel=\"noopener noreferrer\"><img id=\"d\" alt=\"Dogs of Amazon\"><\/a>\r\n  <script>document.getElementById(\"d\").src = \"https:\/\/images-na.ssl-images-amazon.com\/images\/G\/01\/error\/\" + (Math.floor(Math.random() * 43) + 1) + \"._TTD_.jpg\";<\/script>\r\n<\/div>\r\n<\/body>\r\n<\/html>\r\n\r\nISO-8859-1<\/pre>\n

Passing Arguments with the GET Method<\/h4>\n

Usually, a single GET method does not allow us to get all of the information we require, so we must send additional parameters with our original get request.<\/p>\n

Parameters are mostly key-value pairs of data wrapped in a tuple or list. We can send it using the params parameter of our get() method.<\/p>\n

Example:<\/strong><\/p>\n

# Import requests using the import keyword\r\nimport requests \r\n# Give the dictionary as static input and store it in a variable.\r\npayload_val = {'key1': 'value1', 'key2': 'value2'}\r\n# Get the requests by passing some random URl and payload values as the arguments to it.\r\nmy_req = requests.get('http:\/\/httpbin.org\/get', params=payload_val)\r\n# print the above request\r\nprint(my_req.text)<\/pre>\n

Output:<\/strong><\/p>\n

{\r\n  \"args\": {\r\n    \"key1\": \"value1\", \r\n    \"key2\": \"value2\"\r\n  }, \r\n  \"headers\": {\r\n    \"Accept\": \"*\/*\", \r\n    \"Accept-Encoding\": \"gzip, deflate\", \r\n    \"Host\": \"httpbin.org\", \r\n    \"User-Agent\": \"python-requests\/2.23.0\", \r\n    \"X-Amzn-Trace-Id\": \"Root=1-61b95330-4018303804e1772e3f298164\"\r\n  }, \r\n  \"origin\": \"34.86.125.144\", \r\n  \"url\": \"http:\/\/httpbin.org\/get?key1=value1&key2=value2\"\r\n}\r\n<\/pre>\n

What is POST Request?<\/h3>\n

In contrast, to GET requests in Python, the POST Method in HTTP requires a payload to be sent along with it. Instead of retrieving data directly, this method is used to transfer it to a server. Using the post() method in our requests module, we can access POST.<\/p>\n

Example<\/strong><\/p>\n

# Import requests module using the import keyword\r\nimport requests \r\n# Give the payload dictionary as static input and store it in a variable\r\npayload_val  = {'key_1': 'value_1', 'key_2': 'value_2'}\r\n# Pass the Url and above payload dictionary as arguments to the post() method\r\n# and store in another variable\r\nmy_req  = requests.post(\"https:\/\/httpbin.org\/post\", data=payload_val)\r\n# print the above request\r\nprint(my_req .text)<\/pre>\n

Output:<\/strong><\/p>\n

{\r\n\"args\": {}, \r\n\"data\": \"\", \r\n\"files\": {}, \r\n\"form\": {\r\n\"key_1\": \"value_1\", \r\n\"key_2\": \"value_2\"\r\n}, \r\n\"headers\": {\r\n\"Accept\": \"*\/*\", \r\n\"Accept-Encoding\": \"gzip, deflate\", \r\n\"Content-Length\": \"27\", \r\n\"Content-Type\": \"application\/x-www-form-urlencoded\", \r\n\"Host\": \"httpbin.org\", \r\n\"User-Agent\": \"python-requests\/2.23.0\", \r\n\"X-Amzn-Trace-Id\": \"Root=1-61cf20c7-4887ec7502308d5a0671e1ae\"\r\n}, \r\n\"json\": null, \r\n\"origin\": \"35.245.205.160\", \r\n\"url\": \"https:\/\/httpbin.org\/post\"\r\n}<\/pre>\n

Python Advanced Request Features<\/h4>\n

GET and POST are the most fundamental and important HTTP methods. However, the requests module allows a variety of such methods such as PUT, PATCH, DELETE, and so on.<\/p>\n

These are some of the main reasons why the ‘requests’ module is so popular among developers is because of advanced features such as:<\/p>\n

Sessions Object:<\/strong> It is mostly used to store the same cookies across multiple requests, resulting in a speedier response.<\/p>\n

SOCKS Proxies are supported:<\/strong> Although a second requirement (called’requests[socks]’ must be installed, it can considerably improve your performance for many requests, especially if the server rate limits your IP.<\/p>\n

SSL Verification:<\/strong> By passing an extra parameter “verify=True” within the get() method, you can force check if a website fully supports SSL. If the website does not support SSL properly, the script will throw an error.<\/p>\n

 <\/p>\n

 <\/p>\n

 <\/p>\n","protected":false},"excerpt":{"rendered":"

Requests in Python is a great module that allows you to use Python to send HTTP\/1.1 requests to web pages. Python 2.7 and 3.5+ are both officially supported. Keep \u2013 Alive, Connection Pooling, Sessions with permanent cookies, and Browser Style SSL verification make it the preferred solution for developers. In this post, we’ll go over …<\/p>\n

Requests in Python: Using Python to Request Web Pages<\/span> Read More »<\/a><\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[5],"tags":[],"yoast_head":"\nRequests in Python: Using Python to Request Web Pages - Python Programs<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/python-programs.com\/requests-in-python-using-python-to-request-web-pages\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Requests in Python: Using Python to Request Web Pages - Python Programs\" \/>\n<meta property=\"og:description\" content=\"Requests in Python is a great module that allows you to use Python to send HTTP\/1.1 requests to web pages. Python 2.7 and 3.5+ are both officially supported. Keep \u2013 Alive, Connection Pooling, Sessions with permanent cookies, and Browser Style SSL verification make it the preferred solution for developers. In this post, we’ll go over … Requests in Python: Using Python to Request Web Pages Read More »\" \/>\n<meta property=\"og:url\" content=\"https:\/\/python-programs.com\/requests-in-python-using-python-to-request-web-pages\/\" \/>\n<meta property=\"og:site_name\" content=\"Python Programs\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/btechgeeks\" \/>\n<meta property=\"article:published_time\" content=\"2022-01-03T03:48:38+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@btech_geeks\" \/>\n<meta name=\"twitter:site\" content=\"@btech_geeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vikram Chiluka\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https:\/\/python-programs.com\/#organization\",\"name\":\"BTech Geeks\",\"url\":\"https:\/\/python-programs.com\/\",\"sameAs\":[\"https:\/\/www.instagram.com\/btechgeeks\/\",\"https:\/\/www.linkedin.com\/in\/btechgeeks\",\"https:\/\/in.pinterest.com\/btechgeek\/\",\"https:\/\/www.youtube.com\/channel\/UC9MlCqdJ3lKqz2p5114SDIg\",\"https:\/\/www.facebook.com\/btechgeeks\",\"https:\/\/twitter.com\/btech_geeks\"],\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/python-programs.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/python-programs.com\/wp-content\/uploads\/2020\/11\/BTechGeeks.png\",\"contentUrl\":\"https:\/\/python-programs.com\/wp-content\/uploads\/2020\/11\/BTechGeeks.png\",\"width\":350,\"height\":70,\"caption\":\"BTech Geeks\"},\"image\":{\"@id\":\"https:\/\/python-programs.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/python-programs.com\/#website\",\"url\":\"https:\/\/python-programs.com\/\",\"name\":\"Python Programs\",\"description\":\"Python Programs with Examples, How To Guides on Python\",\"publisher\":{\"@id\":\"https:\/\/python-programs.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/python-programs.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/python-programs.com\/requests-in-python-using-python-to-request-web-pages\/#webpage\",\"url\":\"https:\/\/python-programs.com\/requests-in-python-using-python-to-request-web-pages\/\",\"name\":\"Requests in Python: Using Python to Request Web Pages - Python Programs\",\"isPartOf\":{\"@id\":\"https:\/\/python-programs.com\/#website\"},\"datePublished\":\"2022-01-03T03:48:38+00:00\",\"dateModified\":\"2022-01-03T03:48:38+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/python-programs.com\/requests-in-python-using-python-to-request-web-pages\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/python-programs.com\/requests-in-python-using-python-to-request-web-pages\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/python-programs.com\/requests-in-python-using-python-to-request-web-pages\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/python-programs.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Requests in Python: Using Python to Request Web Pages\"}]},{\"@type\":\"Article\",\"@id\":\"https:\/\/python-programs.com\/requests-in-python-using-python-to-request-web-pages\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/python-programs.com\/requests-in-python-using-python-to-request-web-pages\/#webpage\"},\"author\":{\"@id\":\"https:\/\/python-programs.com\/#\/schema\/person\/fb109fd98e2d5a15fd4dac9970797602\"},\"headline\":\"Requests in Python: Using Python to Request Web Pages\",\"datePublished\":\"2022-01-03T03:48:38+00:00\",\"dateModified\":\"2022-01-03T03:48:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/python-programs.com\/requests-in-python-using-python-to-request-web-pages\/#webpage\"},\"wordCount\":582,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/python-programs.com\/#organization\"},\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/python-programs.com\/requests-in-python-using-python-to-request-web-pages\/#respond\"]}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/python-programs.com\/#\/schema\/person\/fb109fd98e2d5a15fd4dac9970797602\",\"name\":\"Vikram Chiluka\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/python-programs.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c56c77f578d45de43af6feb443618ed7?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c56c77f578d45de43af6feb443618ed7?s=96&d=mm&r=g\",\"caption\":\"Vikram Chiluka\"},\"url\":\"https:\/\/python-programs.com\/author\/vikram\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Requests in Python: Using Python to Request Web Pages - Python Programs","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/python-programs.com\/requests-in-python-using-python-to-request-web-pages\/","og_locale":"en_US","og_type":"article","og_title":"Requests in Python: Using Python to Request Web Pages - Python Programs","og_description":"Requests in Python is a great module that allows you to use Python to send HTTP\/1.1 requests to web pages. Python 2.7 and 3.5+ are both officially supported. Keep \u2013 Alive, Connection Pooling, Sessions with permanent cookies, and Browser Style SSL verification make it the preferred solution for developers. In this post, we’ll go over … Requests in Python: Using Python to Request Web Pages Read More »","og_url":"https:\/\/python-programs.com\/requests-in-python-using-python-to-request-web-pages\/","og_site_name":"Python Programs","article_publisher":"https:\/\/www.facebook.com\/btechgeeks","article_published_time":"2022-01-03T03:48:38+00:00","twitter_card":"summary_large_image","twitter_creator":"@btech_geeks","twitter_site":"@btech_geeks","twitter_misc":{"Written by":"Vikram Chiluka","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","@id":"https:\/\/python-programs.com\/#organization","name":"BTech Geeks","url":"https:\/\/python-programs.com\/","sameAs":["https:\/\/www.instagram.com\/btechgeeks\/","https:\/\/www.linkedin.com\/in\/btechgeeks","https:\/\/in.pinterest.com\/btechgeek\/","https:\/\/www.youtube.com\/channel\/UC9MlCqdJ3lKqz2p5114SDIg","https:\/\/www.facebook.com\/btechgeeks","https:\/\/twitter.com\/btech_geeks"],"logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/python-programs.com\/#\/schema\/logo\/image\/","url":"https:\/\/python-programs.com\/wp-content\/uploads\/2020\/11\/BTechGeeks.png","contentUrl":"https:\/\/python-programs.com\/wp-content\/uploads\/2020\/11\/BTechGeeks.png","width":350,"height":70,"caption":"BTech Geeks"},"image":{"@id":"https:\/\/python-programs.com\/#\/schema\/logo\/image\/"}},{"@type":"WebSite","@id":"https:\/\/python-programs.com\/#website","url":"https:\/\/python-programs.com\/","name":"Python Programs","description":"Python Programs with Examples, How To Guides on Python","publisher":{"@id":"https:\/\/python-programs.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/python-programs.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/python-programs.com\/requests-in-python-using-python-to-request-web-pages\/#webpage","url":"https:\/\/python-programs.com\/requests-in-python-using-python-to-request-web-pages\/","name":"Requests in Python: Using Python to Request Web Pages - Python Programs","isPartOf":{"@id":"https:\/\/python-programs.com\/#website"},"datePublished":"2022-01-03T03:48:38+00:00","dateModified":"2022-01-03T03:48:38+00:00","breadcrumb":{"@id":"https:\/\/python-programs.com\/requests-in-python-using-python-to-request-web-pages\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/python-programs.com\/requests-in-python-using-python-to-request-web-pages\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/python-programs.com\/requests-in-python-using-python-to-request-web-pages\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/python-programs.com\/"},{"@type":"ListItem","position":2,"name":"Requests in Python: Using Python to Request Web Pages"}]},{"@type":"Article","@id":"https:\/\/python-programs.com\/requests-in-python-using-python-to-request-web-pages\/#article","isPartOf":{"@id":"https:\/\/python-programs.com\/requests-in-python-using-python-to-request-web-pages\/#webpage"},"author":{"@id":"https:\/\/python-programs.com\/#\/schema\/person\/fb109fd98e2d5a15fd4dac9970797602"},"headline":"Requests in Python: Using Python to Request Web Pages","datePublished":"2022-01-03T03:48:38+00:00","dateModified":"2022-01-03T03:48:38+00:00","mainEntityOfPage":{"@id":"https:\/\/python-programs.com\/requests-in-python-using-python-to-request-web-pages\/#webpage"},"wordCount":582,"commentCount":0,"publisher":{"@id":"https:\/\/python-programs.com\/#organization"},"articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/python-programs.com\/requests-in-python-using-python-to-request-web-pages\/#respond"]}]},{"@type":"Person","@id":"https:\/\/python-programs.com\/#\/schema\/person\/fb109fd98e2d5a15fd4dac9970797602","name":"Vikram Chiluka","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/python-programs.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c56c77f578d45de43af6feb443618ed7?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c56c77f578d45de43af6feb443618ed7?s=96&d=mm&r=g","caption":"Vikram Chiluka"},"url":"https:\/\/python-programs.com\/author\/vikram\/"}]}},"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/python-programs.com\/wp-json\/wp\/v2\/posts\/26283"}],"collection":[{"href":"https:\/\/python-programs.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/python-programs.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/python-programs.com\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/python-programs.com\/wp-json\/wp\/v2\/comments?post=26283"}],"version-history":[{"count":5,"href":"https:\/\/python-programs.com\/wp-json\/wp\/v2\/posts\/26283\/revisions"}],"predecessor-version":[{"id":26458,"href":"https:\/\/python-programs.com\/wp-json\/wp\/v2\/posts\/26283\/revisions\/26458"}],"wp:attachment":[{"href":"https:\/\/python-programs.com\/wp-json\/wp\/v2\/media?parent=26283"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/python-programs.com\/wp-json\/wp\/v2\/categories?post=26283"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/python-programs.com\/wp-json\/wp\/v2\/tags?post=26283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}