Взгляните на httplib2, который - рядом с большим количеством очень полезных функций - обеспечивает точно, что Вы хотите.
import httplib2
resp, content = httplib2.Http().request("http://example.com/foo/bar")
то, Где содержание было бы органом по ответу (как строка), и resp, будет содержать заголовки ответа и состояние.
Это не прибывает включенное со стандартной установкой Python, хотя (но это только требует стандартного Python), но это определенно стоит проверить.
M-x describe-variable load-file-name
load-file-name is a variable defined in `C source code'.
Documentation:
Full name of file being loaded by `load'.
You might also be interested in the symbol-file
function, which will tell you the absolute filename in which a specified function or variable was defined.
If you want to get fancy, you can check the load-in-progress
variable. If that's nil
, then no load is in progress (and you're presumably being eval
'd in a buffer). In that case, you could try (buffer-file-name)
to get the filename.