Python

Python modules and usage tips that I use often

Misc

  • Get a dynamically updated print output

for i in range(182930):
    print(f"\rNow the value is{i}", flush=False, end="")
  • Running a python script with -i flag brings us to the end of the exectuion and prompts a python shell

pyhton3 -i exploit.py
  • To inspect what are the supported methods available from the output object the dir can be used

resp = requests.get("https://dhaneshsivasamy07.gitbook.io")

# look at the supported attributes
dir(resp)
# access the method
resp.text 
resp.elapsed
resp.status_code
# can be further inspected
dir(resp.text)
dir(resp.elapsed)
# accessing
resp.elapsed.microseconds
resp.elapsed.total_seconds()

Requests

  • Requests module are used to make requests to the webpage

Last updated

Was this helpful?