简体   繁体   中英

How does requests module work?

I'm looking at the requests module, and I don't understand how the method requests.get() can be invoked.

In the root directory of requests module, there is api.py module that has method get(url, **kwargs) . Then, how come I don't have to do requests.api.get() to invoke it?

Line #60 of https://github.com/kennethreitz/requests/blob/master/requests/__init__.py should make it clear. Basically the reason you don't have to explicitly import it or declare it is because it's already being abstracted away for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM