albibacsi

urllib3

Apr 10th, 2019
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. #!/usr/bin/python3
  2. # -*- coding: utf-8 -*-
  3.  
  4. import http
  5. import os
  6. import urllib3
  7.  
  8. # print request headers
  9. http.client.HTTPConnection.debuglevel=5
  10.  
  11. h = urllib3.PoolManager()
  12. r = h.request('GET', '127.0.0.1:8080/',
  13.                  headers={'access-token': os.getenv('MY_API_KEY')},
  14.                  timeout=urllib3.Timeout(connect=10.0))
Advertisement
Add Comment
Please, Sign In to add comment