Created
July 12, 2019 06:48
-
-
Save loftwah/85c5328ab70433732665891a21f50293 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import urllib3 | |
from requests.auth import HTTPBasicAuth | |
import pysnooper | |
@pysnooper.snoop() | |
def main(): | |
urllib3.disable_warnings() | |
url = "https://172.20.0.3:8092/api/v3/isos/CentOS-7-x86_64-Minimal-1810" | |
file = "CentOS-7-x86_64-Minimal-1810.iso" | |
files = {"CentOS-7-x86_64-Minimal-1810.iso": open(file, "rb")} | |
r = requests.post( | |
url, | |
headers={'Accept': 'application/x-gzip','Content-Type': 'application/octet-stream'}, | |
files=files, | |
auth=HTTPBasicAuth( | |
username="rocketskates", | |
password="r0cketsk8ts" | |
), | |
verify=False | |
) | |
return r.json() | |
@pysnooper.snoop() | |
def logs(): | |
r = requests.get( | |
'https://172.20.0.3:8092/api/v3/logs', | |
auth=HTTPBasicAuth( | |
username="rocketskates", | |
password="r0cketsk8ts", | |
), | |
verify=False | |
) | |
return r.json() | |
main() | |
logs() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment