Skip to content

Instantly share code, notes, and snippets.

@hisaotsu
Created July 24, 2019 12:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hisaotsu/6a76e170c9a1736ceb812b5c2aac3d63 to your computer and use it in GitHub Desktop.
Save hisaotsu/6a76e170c9a1736ceb812b5c2aac3d63 to your computer and use it in GitHub Desktop.
# REST Sample 1
# REST Support
import requests
import pprint
def main():
print("## Sample REST API by Python")
print("Please enter user ID:")
user_name = input()
print("Please enter password:")
password = input()
# target_url = "https://<appliance host name>:215/api/"
target_url = "https://192.168.150.240:215/api/"
print(" - Login")
response = requests.get(target_url + "access/v1", auth=(user_name,password), verify=False)
pprint.pprint(response.json())
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment