Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scripted update of web page
#5
Perhaps you could use Selenium. It will handle the session, the cookies, JS and you can interact with any part of the webpage.

Before that try to read the JSON file and deserialize it.

import json

url_cmdb_test = "http://idcsrv190/cmdb/api2/ci"
user,password = get_name_and_password( credential_file_name )
 
report_json_to_file = os.path.normpath(os.path.join(os.getcwd(),"test-ci_2.json"))
file_json_test = open(report_json_to_file, "r", encoding="utf-8").read()
data = json.loads(file_json_test) # here you turn the json into a python dictionary
headers = {"Content-Type" : "application/json;charset=utf-8"}
ret = requests.post(url=url_cmdb_test, data=data, headers=headers, auth=requests.auth.HTTPBasicAuth( user, password ), verify=False) # data=data
print(str(ret.status_code))
print(str(ret.text))
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Messages In This Thread
Scripted update of web page - by treatitwell - Jan-05-2018, 09:07 PM
RE: Scripted update of web page - by wavic - Jan-06-2018, 12:16 AM
RE: Scripted update of web page - by treatitwell - Jan-06-2018, 01:27 AM
RE: Scripted update of web page - by treatitwell - Jan-06-2018, 03:06 AM
RE: Scripted update of web page - by wavic - Jan-06-2018, 03:16 AM
RE: Scripted update of web page - by treatitwell - Jan-06-2018, 03:19 AM
RE: Scripted update of web page - by snippsat - Jan-06-2018, 02:21 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  use Xpath in Python :: libxml2 for a page-to-page skip-setting apollo 2 3,675 Mar-19-2020, 06:13 PM
Last Post: apollo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020