Question
Please help as much as you can it’s pretty much just terms
What is the main purpose of the python-requests module? What kinds of requests can it make, and what types of responses might
media%2F58a%2F58ad5d5c-8744-4a26-94ae-33
What is the main purpose of the python-requests module? What kinds of requests can it make, and what types of responses might be returned? Text? HTML? JSON? Images? What is JSON? How does it compare to CSV? Whern processed using the json.loads) method, what Python data structure does the imported JSON get imported as. What is an HTML Document Object Model (DOM) and how does that relate to "web scraping"? How do you find (select) elements on a page using BeautifulSoup? How does this relate to CSS selectors? How do you select all elements of a type or class? How do you select an element by its ID? What is the difference between an element attribute and element text? What is the purpose of a regular expression? What are the main things you can do with the re library in Python? What are some challenges that regular expression help you solve that can't be solved simply by using the string.find(.. method? What are subprocesses? Why might you want to execute a subprocess in Python? How do you use the subprocess module in Python to run a program? Pass parameters to a program? Execute another Python script? What is an "exit code" and why might you as a script writer care?
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please find answers below:

1. Python Request Module
Python Request Module is basically a module using which you can send all kinds of HTTP/HTTPS requests. Using the module we can pass parameters in the request URL, send custom headers, do SSL verification. It can be used to send XML or JSON or any custom raw request and receive the response from the server application. Response from server application can be in any format, either HTML, XML, JSON or any custom format.

2.

What is JSON ?

JSON stands for JavaScript Object Notation. Its a light weight format for storing and sending data. As JSON is light weight than traditional web services (SOAP) it takes less bandwidth and hence much faster to transport from one server to another or server to any client.

Comparison between JSON and CSV:
a. JSON support hierarchical data which is not supported by CSV
b. You don't need to write custom parsers for parsing JSON but if we add one more column you will have make changes in parser program which is an overhead.

3.

What is HTML DOM ?

The DOM is a W3C standard for accessing documents (HTML or XML). HTML DOM is a object model and programming interface for HTML. The standard defines HTML elements as objects, properties of HTML elements, methods to access elements and event for elements. In simple words HTML DOM is guidelines on how to get, change, add or delete HTML elements.

4.
Get element by ID: dom.getElementById("elementID");
Get element by Class name: dom.getElementsByClassName("class_name")
Get element by Name: dom.getElementsByName("name")
Get element by Tag Name: dom.getElementsByTagName("tag_name")

5. Regular expression is a string of text that helps to create a pattern which then help match and find text.

6.

Python Subprocess: The module enable a programmer to start new applications for a python program. Sub process can be by using Popen function call. Sub processes modules allow us to spawn processes using which we can execute multiple processes at same time.

Start sub process in python:

#!/usr/bin/env python
from subprocess import Popen, PIPE
myprocess = Popen(['cat', 'program.py'], stdout=PIPE, stderr=PIPE)
stdout, stderr = myprocess.communicate()
print stdout

process.communicate() call reads input and output from the process.
subprocess.call() is used to start program

6.

CSV: CSV stands for Comma Separated Values files which is a plain text file containing list of data separated by delimiter lime comma, semicolon, pipe, etc
CSV doesn't support hierarchical data which is supported by XML.
CSV is much light weighted that XML and should be used when data size is very big.
Custom parsers are required to parse CSV which is not required in XML.

7. HTTP conversation is between client and server wherein client sends a GET or POST request, servers processes the request from client and send the response to client.
Difference between GET and POST
a. Parameters are sent as part of URL in case of GET and hence can be viewed as part of browser history.
b. GET is less secure than POST
c. GET should NOT be used for sending sensitive data.

Add a comment
Know the answer?
Add Answer to:
Please help as much as you can it’s pretty much just terms What is the main purpose of the python-requests module? What kinds of requests can it make, and what types of responses might be returne...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • please use python and provide run result, thank you! click on pic to make it bigger...

    please use python and provide run result, thank you! click on pic to make it bigger For this assignment you will have to investigate the use of the Python random library's random generator function, random.randrange(stop), randrange produces a random integer in the range of 0 to stop-1. You will need to import random at the top of your program. You can find this in the text or using the online resources given in the lectures A Slot Machine Simulation Understand...

  • Please read the article and answer about questions. You and the Law Business and law are...

    Please read the article and answer about questions. You and the Law Business and law are inseparable. For B-Money, the two predictably merged when he was negotiat- ing a deal for his tracks. At other times, the merger is unpredictable, like when your business faces an unexpected auto accident, product recall, or government regulation change. In either type of situation, when business owners know the law, they can better protect themselves and sometimes even avoid the problems completely. This chapter...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT