2

Hello i tried run the run.py but i got an error message!

Run.py

from modules import HTTPHeaders
site = "https://google.com"
HTTPHeaders(site, _verbose=True)

HTTPHeaders.py

import dns
import dns.resolver
def HTTPHeaders(site, _verbose=None):
if _verbose != None:
    try:
        r = http.request('GET', "http://"+site)
    except:
        pass

    if (r.status == 200):
        print("HTTP/1.1 200 OK")
    else:
        print(r.status)
    try:
        print("Content-Type : "+r.headers['Content-Type'])
    except:
        pass
    try:
        print("Server : "+r.headers['Server'])
    except:
        pass
    try:
        print("Set-Cookie : "+r.headers['Set-Cookie'])
    except:
        pass

My error :

    TypeError: 'module' object is not callable

How can i fix this error ? Thank you :)

dada
  • 13
  • 1
  • 1
  • 3
  • 1
    As the error very clearly indicates, you are trying to call the imported module which is not possible. What you intended to do, is call the **function** with the same name from within this module: `HTTPHeaders.HTTPHeaders(site, _verbose=True)` – Tomerikoo Nov 02 '20 at 10:53

1 Answers1

6

Try this:

from modules import HTTPHeaders
HTTPHeaders.HTTPHeaders(...)

You imported the module itself, so you have to access the function using the dot notation.

Alternatively import the function like this:

from modules.HTTPHeaders import HTTPHeaders
HTTPHeaders(...)
sanitizedUser
  • 1,723
  • 3
  • 18
  • 33