aiorule34/aiorule34.py
async def rule34get(tags = None, limit: int = 50, pid: int = None) -> List[Rule34Image]:
	'''Fetch a certain amount of images asyncronously from rule34.xxx

	Parameters
	----------
	tags: Optional[:class:`str`,`list`]
		the tags to search for
		if passing a string the tags must be seperated by one whitespace each
	limit: Optional[:class:`int`]
		the amount of images to retrive from rule34
		must be between 1 and 100 as per API rules
	pid: Optional[:class:`int`]
		specify this to search for a post with a specific id
		instead of using tags to search

	Raises
	------------
	AttributeError:
		when both tags and pid are passed,
		neither tags or pid are passed or
		when limit is out of range of 1 and 100 as per api rules

	LookupError:
		when nothing is found from the search

	Yields
	-----------
	list [:class:`Rule34Image`]
		a list of image objects fetched from rule34.xxx
	'''
	if tags is None and pid is None:
		raise AttributeError('either tags or pid must be used')
	elif tags is not None and pid is not None:
		raise AttributeError('only tags or pid can be specified, not both')
	elif not 1 <= limit <= 100:
		raise AttributeError('The page limit must be between 1 and 100')

	if isinstance(tags, list):
		tags = ' '.join(tags)

	if pid is None:
		url = 'https://rule34.xxx/index.php?page=dapi&s=post&q=index&tags={tags}&limit={limit}'.format(
			tags = tags,
			limit = limit
		)
	else:
		url = 'https://rule34.xxx/index.php?page=dapi&s=post&q=index&id={}'.format(pid)


	async with aiohttp.ClientSession() as session:
		async with session.get(url) as resp:
			root = fromstring(await resp.text())

			if not root and pid is None:
				raise LookupError('Nothing with tags <{}> found'.format(tags))

			elif not root:
				raise LookupError('No post with an id of <{}> found'.format(pid))

			for post in root:
				yield Rule34Image(**post.attrib)
Fetch a certain amount of images asyncronously from rule34.xxx

	Parameters
	----------
	tags: Optional[:class:`str`,`list`]
		the tags to search for
		if passing a string the tags must be seperated by one whitespace each
	limit: Optional[:class:`int`]
		the amount of images to retrive from rule34
		must be between 1 and 100 as per API rules
	pid: Optional[:class:`int`]
		specify this to search for a post with a specific id
		instead of using tags to search

	Raises
	------------
	AttributeError:
		when both tags and pid are passed,
		neither tags or pid are passed or
		when limit is out of range of 1 and 100 as per api rules

	LookupError:
		when nothing is found from the search

	Yields
	-----------
	list [:class:`Rule34Image`]
		a list of image objects fetched from rule34.xxx
	
Fetch a certain amount of images asyncronously from rule34.xxx
Parameters



Raises

when both tags and pid are passed,
neither tags or pid are passed or
when limit is out of range of 1 and 100 as per api rules

when nothing is found from the search

Yields

list [:class:`Rule34Image`]
a list of image objects fetched from rule34.xxx
Fetch a certain amount of images asyncronously from rule34 . xxx Parameters Raises when both tags and pid are passed neither tags or pid are passed or when limit is out of range of 1 and 100 as per api rules when nothing is found from the search Yields list [ : class : ` Rule34Image ` ] a list of image objects fetched from rule34 . xxx
async def rule34get(tags = None, limit: int = 50, pid: int = None) -> List[Rule34Image]:
	if tags is None and pid is None:
		raise AttributeError('either tags or pid must be used')
	elif tags is not None and pid is not None:
		raise AttributeError('only tags or pid can be specified, not both')
	elif not 1 <= limit <= 100:
		raise AttributeError('The page limit must be between 1 and 100')
	if isinstance(tags, list):
		tags = ' '.join(tags)
	if pid is None:
		url = 'https://rule34.xxx/index.php?page=dapi&s=post&q=index&tags={tags}&limit={limit}'.format(
			tags = tags,
			limit = limit
		)
	else:
		url = 'https://rule34.xxx/index.php?page=dapi&s=post&q=index&id={}'.format(pid)
	async with aiohttp.ClientSession() as session:
		async with session.get(url) as resp:
			root = fromstring(await resp.text())
			if not root and pid is None:
				raise LookupError('Nothing with tags <{}> found'.format(tags))
			elif not root:
				raise LookupError('No post with an id of <{}> found'.format(pid))
			for post in root:
				yield Rule34Image(**post.attrib)
async def rule34get ( tags = None , limit : int = 50 , pid : int = None ) -> List [ Rule34Image ] : if tags is None and pid is None : raise AttributeError ( 'either tags or pid must be used' ) elif tags is not None and pid is not None : raise AttributeError ( 'only tags or pid can be specified, not both' ) elif not 1 <= limit <= 100 : raise AttributeError ( 'The page limit must be between 1 and 100' ) if isinstance ( tags , list ) : tags = ' ' . join ( tags ) if pid is None : url = 'https://rule34.xxx/index.php?page=dapi&s=post&q=index&tags={tags}&limit={limit}' . format ( tags = tags , limit = limit ) else : url = 'https://rule34.xxx/index.php?page=dapi&s=post&q=index&id={}' . format ( pid ) async with aiohttp . ClientSession ( ) as session : async with session . get ( url ) as resp : root = fromstring ( await resp . text ( ) ) if not root and pid is None : raise LookupError ( 'Nothing with tags <{}> found' . format ( tags ) ) elif not root : raise LookupError ( 'No post with an id of <{}> found' . format ( pid ) ) for post in root : yield Rule34Image ( ** post . attrib )
Fetch a certain amount of images asyncronously from rule34.xxx
Parameters
Fetch a certain amount of images asyncronously from rule34 . xxx Parameters
'''Fetch a certain amount of images asyncronously from rule34.xxx

	Parameters
	----------
	tags: Optional[:class:`str`,`list`]
		the tags to search for
		if passing a string the tags must be seperated by one whitespace each
	limit: Optional[:class:`int`]
		the amount of images to retrive from rule34
		must be between 1 and 100 as per API rules
	pid: Optional[:class:`int`]
		specify this to search for a post with a specific id
		instead of using tags to search

	Raises
	------------
	AttributeError:
		when both tags and pid are passed,
		neither tags or pid are passed or
		when limit is out of range of 1 and 100 as per api rules

	LookupError:
		when nothing is found from the search

	Yields
	-----------
	list [:class:`Rule34Image`]
		a list of image objects fetched from rule34.xxx
	'''
tags
limit
int
pid
int