Example #1
0
def file_client():
    client = Client('test_client/0.1 +http://example.org')
    client._base_url = ''
    client._fetcher = LoggingDelegator(
        FilesystemFetcher(os.path.dirname(os.path.abspath(__file__)) + '/res'))
    client._verbose = True
    client.got = got
    client.posted = posted
    return client
Example #2
0
def memory_client():
    responses = {
        '/artists/1': (b'{"id": 1, "name": "Badger"}', 200),
        '/500': (b'{"message": "mushroom"}', 500),
        '/204': (b'', 204),
    }
    client = Client('ua')
    client._base_url = ''
    client._fetcher = LoggingDelegator(MemoryFetcher(responses))
    client.got = got
    client.posted = posted
    return client