Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python2.7
- import requests, sys
- import json
- import urllib3
- urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
- def connect(hostip,REST):
- fg_host = hostip
- fg_api = REST
- fg_user = 'username'
- fg_pass = 'password'
- login_url = 'https://%s/logincheck' % fg_host
- login_payload = {'username': fg_user, 'secretkey': fg_pass}
- r = requests.post(login_url, data=login_payload, verify=False)
- cookiejar = r.cookies
- r = requests.get('https://%s/api/v2/%s' % (fg_host, fg_api),
- cookies=cookiejar, verify=False)
- state = r.content
- if __name__ == "__main__":
- connect(sys.argv[1],sys.argv[2])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement