much like writing network tooling with the socket librarywhen you're creating tools to interact with web servicesyou'll use the urllib library let' take look at making very simple get request to the no starch press websiteimport urllib body urllib urlopen(print body read(this is the simplest example of how to make get request to website be mindful that we are just fetching the raw page from the no starch websiteand that no javascript or other client-side languages will execute we simply pass in url to the urlopen function and it returns file-like object that allows us to read back the body of what the remote web server returns in most caseshoweveryou are going to want more finely grained control over how you make these requestsincluding being able to define specific headershandle cookiesand create post requests urllib exposes request class that gives you this level of control below is an example of how to create the same get request using the request class and defining custom user-agent http headerimport urllib url headers {headers['user-agent'"googlebotrequest urllib request(url,headers=headersresponse urllib urlopen(requestprint response read(response close(the construction of request object is slightly different than our previous example to create custom headersyou define headers dictionary which allows you to then set the header key and value that you want to use in this casewe're going to make our python script appear to be the googlebot we then create our request object and pass in the url and the headers dictionary and then pass the request object to the urlopen function call this returns normal file-like object that we can use to read in the data from the remote website we now have the fundamental means to talk to web services and websitesso let' create some useful tooling for any web application attack or penetration test