I want my code to take "Request url" as input and gives output as "Response XML". This I want to achieve using python. I don't know how since I'm new to python. Although I know how to do this in Java and for this I already have developed code in Java. So if anyone can help me with this.
Java code snippet:
import java.net.*; // import java packages.
import java.io.*;
import java.net.URL;public class API {public static void main(String[] args) throws Exception {
URL API = new URL("http:server//"); // Create a URL object 'API' that will locate the resources on remote server via HTTP protocol.URLConnection request = API.openConnection(); // Retrieve a URLConnection object 'request' that will establish http connection by using openConnection() method.BufferedReader in = new BufferedReader(new InputStreamReader(request.getInputStream())); // Create an Output stream ‘in’ that will call InputStreamReader to read the contents of the resources.String response;while ((response = in.readLine()) != null) // Write to Output stream until null.System.out.println(response); // prints the response on Console.in.close(); // Close Output stream.}
}