We use Bugsplatsoftware.com to collect all the crashes. They have a RESTFull web service which returns JSON data. I would like to get data for individual crashes. The data is behind a login/password...
I tried the following but the results are not as expected.
import requests
from requests.auth import HTTPBasicAuth
args={'id':11111,'data':0}
response=requests.get("https://www.bugsplatsoftware.com/individualCrash",params=args,auth=HTTPBasicAuth("username","password"))
data=response.json()
response.headers returns following
response.headers
{'content-length': '10549', 'connection': 'close', 'server': 'Apache/2.4.12 (Win32) OpenSSL/1.0.1l PHP/5.5.21', 'x-frame-options': 'SAMEORIGIN', 'x-pingback': 'https://www.bugsplatsoftware.com/xmlrpc.php', 'expires': 'Thu, 19 Nov 1981 08:52:00 GMT', 'cache-control': 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0', 'x-xss-protection': '1; mode=block', 'date': 'Wed, 22 Apr 2015 17:43:37 GMT', 'content-encoding': 'gzip', 'link': '<https://www.bugsplatsoftware.com/?p=363>; rel=shortlink', 'vary': 'Accept-Encoding,User-Agent', 'x-content-type-options': 'nosniff', 'x-powered-by': 'PHP/5.5.21', 'content-type': 'text/html; charset=UTF-8', 'pragma': 'no-cache'}
What do I need to do to get the json data? Thanks in advance.
When I print response.url it shows https://www.bugsplatsoftware.com/login/ instead of https://www.bugsplatsoftware.com/individualCrash/?id=11111&data=0....
marmeladze, "bugsplatsoftware.com/individualCrash?id=11111&data=0"; returns json data (at least in the browser) and this is what I need.
pygeek, when I call response.content it seems like the data is html page.....
Ivan, how do I specify the "content-type" to requests.get?
Seems like I need to do something like Using Python Requests: Sessions, Cookies, and POST I tried the following
import requests
s=requests.Session()
data={"login":'tester',"password":'testing'}
url="https://wwww.bugsplatsoftware.com/login"
r=s.post(url,data=data)
and I get unauthorized error message
or if I simply do
s.get(url) I get too many redirects