1

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?

rypel
  • 4,686
  • 2
  • 25
  • 36
Maximus S
  • 10,759
  • 19
  • 75
  • 154

1 Answers1

1

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.

rdodev
  • 3,164
  • 3
  • 26
  • 34
  • Thanks! that makes sense. Would you take a look at my comment to the answer in http://stackoverflow.com/questions/20276927/django-separating-business-logic-from-view-logic/20277065?noredirect=1#comment30249990_20277065 ? I am trying to understand how to use a method defined in my module. – Maximus S Nov 29 '13 at 02:03
  • @MaximusS sorry mate, cannot help you with that one. Not familiar how django loads their modules. – rdodev Nov 29 '13 at 02:06
  • 1
    @MaximusS try their IRC channel, you might get help there. freenode#django – rdodev Nov 29 '13 at 02:11