WebPagetest Forums
using RESTful APIs - Printable Version

+- WebPagetest Forums (https://www.webpagetest.org/forums)
+-- Forum: WebPagetest (/forumdisplay.php?fid=7)
+--- Forum: General Discussion (/forumdisplay.php?fid=25)
+--- Thread: using RESTful APIs (/showthread.php?tid=13789)

using RESTful APIs - courtney - 06-23-2015 04:07 AM

This may be a bit of a silly question, but I am new to working with external APIs. I am trying to use the built in APIs found on this page: https://sites.google.com/a/webpagetest.org/docs/advanced-features/webpagetest-batch-processing-apis using 'requests'. I import requests and make a 'get' request to 'http://www.webpagetest.org/runtest.php', saving it into a variable. But when I then try to perform actions on the variable, like var.ImportUrls(foo.txt), I get an error that the 'Response' object has no attribute 'ImportUrls'. Do I need to install/import webpage test and/or the specific APIs? If so, are there any instructions available on how to do this?

RE: using RESTful APIs - pmeenan - 06-24-2015 11:53 PM

You can't operate on the variable as if it is a function, it is data and has attributes (depending on the language) that you can read out. i.e. you can get the value of var.data.id to get the test ID.