Skip to content

Instantly share code, notes, and snippets.

@Shellbye
Created December 4, 2018 06:37
Show Gist options
  • Save Shellbye/90ad6272425099bcb9a78dea0df20e66 to your computer and use it in GitHub Desktop.
Save Shellbye/90ad6272425099bcb9a78dea0df20e66 to your computer and use it in GitHub Desktop.
python3 authentication bearer demo
import urllib.request
headers = {"Authorization":"Bearer eyJhbGciOiJIUzUxMiJ1.eyJzdWIiOiJhZG1pbiIsImF1dGhvcml0aWVzIjpbIlJPTEVfQURNSU4iXSwiaWF0IjoxNTQzOTA0NTY5LCJleHAiOjE1NDM5OTA5Njl9.0MLfJa9oud0ZMNC2e0q8YciuuB1G56KZH3m87ilrd7ryy4sjtR2U0MQnWSd89u-liWo1gLAgX9OyIDUnFXzJUw"}
req = urllib.request.Request(url="http://127.0.0.1:8090", headers=headers)
contents = urllib.request.urlopen(req).read()
print(contents)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment