Ejemplo n.º 1
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import asyncio

try:
    from . import api, peony
except (SystemError, ImportError):
    import api
    from __init__ import peony

loop = asyncio.get_event_loop()
client = peony.PeonyClient(**api.keys, loop=loop)


async def search_test():
    print(await client.api.search.tweets.get(q="@twitter hello :)"))
    print(client.headers)


if __name__ == '__main__':
    loop.run_until_complete(search_test())
Ejemplo n.º 2
0
from urllib.parse import urlparse

import aiofiles

try:
    import PIL.Image
except ImportError:
    PIL = None

try:
    from . import peony, api
except (SystemError, ImportError):
    from __init__ import peony, utils
    import api

client = peony.PeonyClient(**api.keys)


def convert(img, formats):
    """
        Convert the image to all the formats specified
    Parameters
    ----------
    img : PIL.Image.Image
        The image to convert
    formats : list
        List of all the formats to use
    Returns
    -------
    io.BytesIO
        A file object containing the converted image
Ejemplo n.º 3
0
async def search_test():
    async with peony.PeonyClient(**api.keys) as client:
        print(await client.user)