Advertisement
Guest User

Untitled

a guest
Mar 5th, 2017
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. import requests
  2. import sqlite3 as lite
  3.  
  4. con = lite.connect(r"test.db")
  5.  
  6. cur = con.cursor()
  7. cur.execute("CREATE TABLE main(id INTEGER PRIMARY KEY AUTOINCREMENT, status_code TEXT, headers TEXT, content TEXT)")
  8.  
  9. r = requests.head("https://ya.ru")
  10.  
  11. status_code = r.status_code
  12. headers = "%s" % r.headers
  13. content = "%s" % r.content
  14.  
  15. cur.execute(u"""INSERT INTO main (status_code, headers, content) VALUES (?,?,?)""", (status_code, headers, content,))
  16. con.commit()
  17.  
  18. print (r.status_code)
  19. print (r.headers)
  20. print (r.content)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement