# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['presto']

package_data = \
{'': ['*']}

install_requires = \
['attrdict3>=2.0.2,<3.0.0', 'requests>=2.28.1,<3.0.0']

extras_require = \
{'async': ['httpx>=0.23.1,<0.24.0']}

setup_kwargs = {
    'name': 'presto-requests',
    'version': '1.3.1',
    'description': 'A modern object-oriented HTTP REST client.',
    'long_description': '# Presto! Requests\n\nAn object-oriented REST API client & requests extesion library.\n\nAs of version 1.0.0, this library can be considered stable, and significant\nchanges to the interface or new features are unlikely to be introduced.\n\n#### Note: This library requires Python 3.11.0rc1 or later.\n\n## Installation\n\n```bash\npip install presto-requests\n```\n```bash\npoetry add presto-requests\n```\n\n#### With async support using httpx:\n```bash\npip install presto-requests[async]\n```\n```bash\npoetry add presto-requests --extras async\n```\n\n### Concept:\n\nPresto! Requests is a library that extends the functionality of the requests library.\nIt provides a simple way to create a REST API client that is object-oriented and easy to use.\n\n### Example:\n\n```python\nfrom presto import Presto\nimport pprint\n\npresto = Presto("https://api.github.com")\n\nuser = presto.users.sitbon()  # == presto.users["sitbon"]()\n\nprint(f"User {user.attr.login} has {user.attr.public_repos} public repositories.")\n\npprint.pprint(user.json())\n```\n```shell\nUser sitbon has 15 public repositories.\n{\'avatar_url\': \'https://avatars.githubusercontent.com/u/1381063?v=4\',\n \'bio\': None,\n \'blog\': \'\',\n \'company\': None,\n \'created_at\': \'2012-01-26T04:25:21Z\',\n \'email\': None,\n \'events_url\': \'https://api.github.com/users/sitbon/events{/privacy}\',\n \'followers\': 7,\n \'followers_url\': \'https://api.github.com/users/sitbon/followers\',\n \'following\': 13,\n \'following_url\': \'https://api.github.com/users/sitbon/following{/other_user}\',\n \'gists_url\': \'https://api.github.com/users/sitbon/gists{/gist_id}\',\n \'gravatar_id\': \'\',\n \'hireable\': None,\n \'html_url\': \'https://github.com/sitbon\',\n \'id\': 1381063,\n \'location\': \'Portland, OR, USA\',\n \'login\': \'sitbon\',\n \'name\': \'Phillip Sitbon\',\n \'node_id\': \'MDQ6VXNlcjEzODEwNjM=\',\n \'organizations_url\': \'https://api.github.com/users/sitbon/orgs\',\n \'public_gists\': 4,\n \'public_repos\': 15,\n \'received_events_url\': \'https://api.github.com/users/sitbon/received_events\',\n \'repos_url\': \'https://api.github.com/users/sitbon/repos\',\n \'site_admin\': False,\n \'starred_url\': \'https://api.github.com/users/sitbon/starred{/owner}{/repo}\',\n \'subscriptions_url\': \'https://api.github.com/users/sitbon/subscriptions\',\n \'twitter_username\': None,\n \'type\': \'User\',\n \'updated_at\': \'2022-11-22T00:41:18Z\',\n \'url\': \'https://api.github.com/users/sitbon\'}\n\n```\n\n### Usage:\n\nEach dot in the path of the request is a new request object.\n\nCalling the object without any arguments will execute the request and return the response object.\n\nIndexing the object like a list is a convient way to extend the path to a new object for things\nlike id paths, e.g. `presto.note[1]()`.\n\nSpecifying keyword arguments will add them to the request as keyword arguments to requests.request(),\nand then return the current object for further chaining.\n\nThere are a few special top-level attributes that can be used to modify the request:\n`get`, `post`, `put`, `patch`, `delete`, `head`, `options`, and finally `request` which is\nan empty path component that can be used to indirectly modify existing top-level auto created request objects.\n\nAll of these top-level attributes are able to clone existing request attributes, to modify the path\nand parent parameters while using the same component path and parameters.\n\nFor example:\n\n```python\nfrom presto import Presto\n\n\npresto = Presto(url="http://127.0.0.1:8000", APPEND_SLASH=True)\n\nprint("presto:", presto)\n\napi = presto.api\n\nprint("api:", api)\n\nnote = api(headers={"X-User": "Testing"}).note\n\nprint("api.note:", api.note, "equal:", api.note == note)\n\nresp = api.note[4]()\n\nprint("headers:", resp.request.headers)\nprint("response:", resp)\nprint("note:", resp.attr)\n```\n```shell\npresto: Presto(url=\'http://127.0.0.1:8000/\', params=adict(method=\'GET\', headers={\'Accept\': \'application/json\'}))\napi: Request(url=\'http://127.0.0.1:8000/api/\', params=adict(method=\'GET\', headers={\'Accept\': \'application/json\'}))\napi.note: Request(url=\'http://127.0.0.1:8000/api/note/\', params=adict(method=\'GET\', headers={\'Accept\': \'application/json\', \'X-User\': \'Testing\'})) equal: True\nheaders: {\'User-Agent\': \'python-requests/2.28.1\', \'Accept-Encoding\': \'gzip, deflate\', \'Accept\': \'application/json\', \'Connection\': \'keep-alive\', \'X-User\': \'Testing\'}\nresponse: <Response [200]>\nnote: adict(user=\'\', id=4, url=\'http://127.0.0.1:8000/api/note/4/\', time=\'2022-12-02T19:26:09-0800\', note=\'Hello from the API!!\', collection={\'id\': 3, \'url\': \'http://127.0.0.1:8000/api/note/coll/3/\', \'name\': \'Public\', \'public\': True, \'notes\': 1})\n```\n\n`response.attr` is an `adict` instance, which is a dictionary that can be accessed as attributes.\nIt contains the JSON-decoded content of a response, if any.\n\n`APPEND_SLASH` is meant to be client implementation-specific, e.g. for a Django Rest Framework client, one would\ntypically set `Presto.APPEND_SLASH = True` or inherit from `Presto` in a pre-defined API client class.\n\n# Async Support\n\nVersion 1.0.0 adds support for async requests using the `httpx` library.\n\nThe usage is the same as the synchronous version except when it comes to executing requests.\n\nInstead of calling `()` an object to execute the request, the .A attribute is awaited.\nSee the example below.\n\n```python\nimport asyncio\nfrom presto.asynco import AsyncPresto as Presto\n\n\nasync def main():\n    presto = Presto(url="http://127.0.0.1:8000", APPEND_SLASH=True)\n\n    print("presto:", presto)\n\n    api = presto.api\n\n    print("api:", api)\n\n    note = api(headers={"X-User": "Testing"}).note\n\n    print("api.note:", api.note, "equal:", api.note == note)\n\n    resp = await api.note[4].A\n\n    print("headers:", resp.request.headers)\n    print("response:", resp)\n    print("note:", resp.attr)\n\nif __name__ == "__main__":\n    asyncio.run(main())\n```\n```shell\npresto: AsyncPresto(url=\'http://127.0.0.1:8000/\', params=adict(method=\'GET\', headers={\'Accept\': \'application/json\'}))\napi: Request(url=\'http://127.0.0.1:8000/api/\', params=adict(method=\'GET\', headers={\'Accept\': \'application/json\'}))\napi.note: Request(url=\'http://127.0.0.1:8000/api/note/\', params=adict(method=\'GET\', headers={\'Accept\': \'application/json\', \'X-User\': \'Testing\'})) equal: True\nheaders: Headers({\'host\': \'127.0.0.1:8000\', \'accept-encoding\': \'gzip, deflate\', \'connection\': \'keep-alive\', \'user-agent\': \'python-httpx/0.23.1\', \'accept\': \'application/json\', \'x-user\': \'Testing\'})\nresponse: <Response [200 OK]>\nnote: adict(user=\'\', id=4, url=\'http://127.0.0.1:8000/api/note/4/\', time=\'2022-12-02T19:26:09-0800\', note=\'Hello from the API!!\', collection={\'id\': 3, \'url\': \'http://127.0.0.1:8000/api/note/coll/3/\', \'name\': \'Public\', \'public\': True, \'notes\': 1})\n```',
    'author': 'Phillip Sitbon',
    'author_email': 'phillip.sitbon@gmail.com',
    'maintainer': 'None',
    'maintainer_email': 'None',
    'url': 'https://github.com/sitbon/presto',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'extras_require': extras_require,
    'python_requires': '>=3.11.0rc1,<4.0.0',
}


setup(**setup_kwargs)
