Example #1
0
class OpenLibrary(object):
    def __init__(self):
        self.__url = 'https://openlibrary.org'
        security = NoneSecurity()
        self.rest = REST(security)

    def searchBookByTitle(self, queryText: str, page: int):
        url = self.__url + "/search.json?title=" + queryText + "&page=" + str(page)
        return self.rest.sendGet(urlCommand = url, command = "")

    def searchBookByAuthor(self, queryText: str, page: int):
        url = self.__url + "/search.json?author=" + queryText + "&page=" + str(page)
        return self.rest.sendGet(urlCommand = url, command = "")
Example #2
0
 def test_sendGet(self):
     url = 'https://w3schools.com/python/demopage.asp'
     command = ""
     security = NoneSecurity()
     rest = REST(security)
     response = rest.sendGet(url, command)
     self.assertTrue(response.status_code, 400)
Example #3
0
class GoodReads(object):
    def __init__(self):
        self.__url = 'https://www.goodreads.com'
        security = NoneSecurity()
        self.rest = REST(security)

    def searchBook(self, queryText: str):
        command = "search: " + queryText
        url = self.__url + "/search/index.xml"
        return self.rest.sendGet(urlCommand=url, command=command)