{ "info": { "author": "Juan Gallostra", "author_email": "juangallostra@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3" ], "description": "Colourlovers-API-wrapper\n========================\n\n.. image:: https://img.shields.io/pypi/v/colourlovers.svg\n :target: https://pypi.org/project/colourlovers/\n\n.. image:: https://img.shields.io/github/issues-pr/juangallostra/Colourlovers-API-wrapper.svg?style=flat-square\n :target: https://github.com/juangallostra/Colourlovers-API-wrapper/pulls\n\n.. image:: https://img.shields.io/github/issues/juangallostra/Colourlovers-API-wrapper.svg?style=flat-square\n :target: https://github.com/juangallostra/Colourlovers-API-wrapper/issues\n\n.. image:: https://img.shields.io/github/contributors/juangallostra/Colourlovers-API-wrapper.svg?style=flat-square\n :target: https://github.com/juangallostra/Colourlovers-API-wrapper\n\n\n\n\nPython wrapper for the `API `__\nprovided by www.colourlovers.com\n\n\nRequirements\n------------\n\n- Python 3 (Check `elbaschid's\n wrapper `__ if\n using Python 2)\n- Pillow\n\n\nHow to use it\n-------------\n\nImport the wrapper\n~~~~~~~~~~~~~~~~~~\n\n1. Download the wrapper via ``pip``:\n ``pip install colourlovers``\n Alternatively, clone the repository by typing in a terminal:\n ``git clone https://github.com/juangallostra/Colourlovers-API-wrapper.git``\n2. Start a Python terminal session in the directory where you cloned the\n repository\n3. Import the wrapper by:\n\n .. code:: python\n\n >>> from colourlovers import clapi\n >>> cl = clapi.ColourLovers()\n\n\nQueries\n~~~~~~~\n\nOnce we have created the API wrapper object (``cl`` in the present\ncase) we are ready to query the API. Note that a query, even if it\nis for a single object, always returns a list. The ColourLovers API\nqueries are structured in three levels:\n\n1. Object of the query. The possible query objects are: Color/s,\n Pattern/s, Palette/s, Lover/s or stats. Note that most of the objects\n can be queried in plural or in singular. The wrapper offers a\n different method for each object, all of them being:\n\n .. code:: python\n\n >>> cl.search_palette() # Query for a single palette\n >>> cl.search_pattern() # Query for a single pattern\n >>> cl.search_color() # Query for a single color\n >>> cl.search_lover() # Query for a single user\n >>> cl.search_palettes() # Query for multiple palettes\n >>> cl.search_patterns() # Query for multiple patterns\n >>> cl.search_colors() # Query for multiple colors\n >>> cl.search_lovers() # Query for multiple users\n >>> cl.search_stats() # Query for a single pattern\n\n Each of these methods only accepts keyword arguments. Optionally, a\n first boolean positional argument can be passed specifying whether\n the response of the query should be returned as raw data or as a\n Python object. By default the response of a query will be returned as\n a Python object. Hence, the general form of a query to the API is:\n\n .. code:: python\n\n >>> cl.search_patterns(True, kwargs) # Response will be returned as raw data\n >>> cl.search_patterns(kwargs) # Response will be returned as a Python object\n\n We will get back to this later.\n\n2. Type of the query. These are general, normally non-object dependent types.\n However, not all the types are supported by all the objects. The possible\n query types and the keyword used to specify them for each type of object are:\n\n +------------+-------------+----------------------------------------------------+\n | Object | Keyword | Value |\n +============+=============+====================================================+\n | Palettes | ``request`` | ``new``, ``top``, ``random`` |\n +------------+-------------+----------------------------------------------------+\n | Patterns | ``request`` | ``new``, ``top``, ``random`` |\n +------------+-------------+----------------------------------------------------+\n | Colors | ``request`` | ``new``, ``top``, ``random`` |\n +------------+-------------+----------------------------------------------------+\n | Lovers | ``request`` | ``new``, ``top`` |\n +------------+-------------+----------------------------------------------------+\n | Palette | ``id`` | valid id as ``int`` or ``str`` |\n +------------+-------------+----------------------------------------------------+\n | Pattern | ``id`` | valid id as ``int`` or ``str`` |\n +------------+-------------+----------------------------------------------------+\n | Color | ``hexvalue``| valid hex color value as ``str`` |\n +------------+-------------+----------------------------------------------------+\n | Lover | ``username``| valid username ``str`` |\n +------------+-------------+----------------------------------------------------+\n | Stats | ``request`` | ``colors``, ``palettes``, ``patterns``, ``lovers`` |\n +------------+-------------+----------------------------------------------------+\n\n The ``random`` query type is exclusive. When using it, no other\n parameters can be specified. Some examples of valid queries are:\n\n .. code:: python\n\n >>> cl.search_patterns(request='new')\n >>> cl.search_colors(request='top')\n >>> cl.search_stats(request='patterns')\n >>> cl.search_palettes(request='random')\n >>> cl.search_pattern(id=1145)\n >>> cl.search_lover(username='whatever')\n >>> cl.search_color(hexvalue='C6C5AC')\n\n3. Object specific query parameters. These depend on the object of the\n query and are also specified as keyword arguments. To see which are\n the parameters supported by each object follow the links to the\n official API page in the following table. Note the differences in the\n available parameters when querying for multiple objects or for a\n single object.\n\n +-------------+-------------------------------------------------------------+\n | Object | Supported Types |\n +=============+=============================================================+\n | Palette/s | `Parameters `__ |\n +-------------+-------------------------------------------------------------+\n | Pattern/s | `Parameters `__ |\n +-------------+-------------------------------------------------------------+\n | Color/s | `Parameters `__ |\n +-------------+-------------------------------------------------------------+\n | Lover/s | `Parameters `__ |\n +-------------+-------------------------------------------------------------+\n | Stats | `Parameters `__ |\n +-------------+-------------------------------------------------------------+\n\n Examples of valid queries are:\n\n .. code:: python\n\n >>> cl.search_palettes(request='top', keywords='river', numResults=15)\n >>> cl.search_lovers(request='new', orderCol='numVotes')\n\n Note that the parameters are case-sensitive and that some of them\n expect predefined values. This edge cases are all listed at the\n `official API documentation `__.\n\n\nResponse data\n~~~~~~~~~~~~~\n\nThe data from a query can be returned in three different formats: XML, JSON or as\na Python object.\n\nTo get the data in XML format a first positional argument (``raw_data``) has to be\nset to ``True``. This is so because the default raw data response format is XML.\n\n .. code:: python\n\n >>> resp = cl.search_palette(True, id=2323)\n >>> resp\n '\\n\\n\\t\\n\\t\\t2323\\n\\t\\t<![CDATA[On the lake]]>\\n\\t\\t\\n\\t\\t529\\n\\t\\t12\\n\\t\\t3\\n\\t\\t0\\n\\t\\t0\\n\\t\\t2005-08-24 10:44:11\\n\\t\\t\\n\\t\\t\\tE6F0F7\\n\\t\\t\\t97A4B2\\n\\t\\t\\t5F0609\\n\\t\\t\\t766F59\\n\\t\\t\\t989383\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\thttp://www.colourlovers.com/api/palette/2323\\n\\t\\n'\n\nTo get the data in JSON format, a part from specifying that the response should be returned\nas raw data by setting the first positional argument to ``True``, it is necessary to include\nanother keyword parameter in the query specifying that the format of the response should be\nJSON (``format='json'``).\n\n .. code:: python\n\n >>> resp = cl.search_palette(True, id=2323, format='json')\n >>> resp\n '[\n {\n \"id\":2323,\n \"title\":\"On the lake\",\n \"userName\":\"viatora\",\n \"numViews\":529,\n \"numVotes\":12,\n \"numComments\":3,\n \"numHearts\":0,\n \"rank\":0,\n \"dateCreated\":\"2005-08-24 10:44:11\",\n \"colors\":[\"E6F0F7\",\"97A4B2\",\"5F0609\",\"766F59\",\"989383\"],\n \"description\":\"I-MOO\\\\r\\\\n
>> resp = cl.search_palette(id=2323)\n >>> resp\n []\n >>> resp = cl.search_palettes(request='top', keywords='river')\n >>> resp\n [,\n ,\n ,\n ,\n ,\n ,\n ,\n ,\n ,\n ,\n ,\n ,\n ,\n ,\n ,\n ,\n ,\n ,\n ,\n ]\n\n\nEach of this objects (Lover, Palette, Pattern, Color, Stats) provides an attribute - named following PEP8\nstyle guidelines - for each of the fields present in the response. Refer to the `official API documentation `__\nto see which fields (Example Result sections) are present for each object. As an example:\n\n .. code:: python\n\n >>> p = cl.search_pattern(id=2323)\n >>> p\n []\n >>> vars(p[0])\n {\n 'id': 2323,\n 'title': 'inspiration',\n 'username': 'daisyjean911',\n 'num_views': 328,\n 'num_votes': 0,\n 'num_comments': 0,\n 'num_hearts': 0,\n 'rank': 0,\n 'date_created': '2007-12-10 12:19:14',\n 'description': '\"Nestled\"\\r\\n
>> pattern = p[0]\n >>> pattern.username\n 'daisyjean911'\n >>> pattern.colors\n ['97BEC9', 'AB2B91', '76A379', 'ABD66B']\n >>> pattern.num_views\n 328\n >>> pattern.id\n 2323\n\n\nOther possible sources for color palettes\n-----------------------------------------\n\n1. https://www.colr.org/api.html - (https://www.colr.org/)\n2. https://www.pictaculous.com/api/ - (https://www.pictaculous.com/)\n3. It is also worth mentioning\n https://github.com/elbaschid/python-colourlovers\n\n\nColourLovers API wrapper CHANGELOG\n==================================\n\n\nAlpha version (unreleased)\n--------------------------\n\n\n**Added**\n\n- #13 Issue and Pull Request templates\n- #22 Documentation: Wrapper usage in README\n- #22 Support search by id when searching for one palette or pattern\n- #22 Support search by username one searching for one user (Lover)\n- #22 Support search by hexvalue when searching for one color\n- #24 Improve usage explanation in the README\n\n**Deleted**\n\n\n**Changed**\n\n- #15 Reduce amount of duplicated code amongst data-holder classes\n- #19 Change names of files and folders\n\n**Fixed**\n\n- #14 When making a query the type of raw-data is checked. In case it is not a boolean value an exception is raised\n- #23 Fix data loss when creating Python container objects\n\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/juangallostra/Colourlovers-API-wrapper/archive/0.1.9.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/juangallostra/Colourlovers-API-wrapper", "keywords": "color,colour,palette,api,colourlovers,wrapper", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "colourlovers", "package_url": "https://pypi.org/project/colourlovers/", "platform": "", "project_url": "https://pypi.org/project/colourlovers/", "project_urls": { "Download": "https://github.com/juangallostra/Colourlovers-API-wrapper/archive/0.1.9.tar.gz", "Homepage": "https://github.com/juangallostra/Colourlovers-API-wrapper" }, "release_url": "https://pypi.org/project/colourlovers/0.1.9/", "requires_dist": [ "Pillow" ], "requires_python": "", "summary": "A python wrapper for ColourLovers API", "version": "0.1.9" }, "last_serial": 3789152, "releases": { "0.1.7": [ { "comment_text": "", "digests": { "md5": "aab5bf5bdb2672e99ef364d2e7e1ee6e", "sha256": "c21f2e10769153f2b3b106cceb0ee9d3dbbda9e45aae16f1f3d310370956a0cf" }, "downloads": -1, "filename": "colourlovers-0.1.7-py3-none-any.whl", "has_sig": false, "md5_digest": "aab5bf5bdb2672e99ef364d2e7e1ee6e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8651, "upload_time": "2018-04-19T18:14:23", "url": "https://files.pythonhosted.org/packages/bc/2a/e24a5038f17fa62132a6f67dfb7a49d4d98d7fb8306122685af512f68c73/colourlovers-0.1.7-py3-none-any.whl" } ], "0.1.9": [ { "comment_text": "", "digests": { "md5": "abb384f4688e5726336412f3969bd95c", "sha256": "e54145583c7d251a9c096d2896d892848afedc1e1542e0e7672173ccbdce7097" }, "downloads": -1, "filename": "colourlovers-0.1.9-py3-none-any.whl", "has_sig": false, "md5_digest": "abb384f4688e5726336412f3969bd95c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10929, "upload_time": "2018-04-22T15:33:52", "url": "https://files.pythonhosted.org/packages/ed/8a/b48e599db17df2f22254ffdc6f6b919f5a0cb4da7a7dd49459aae587ef1e/colourlovers-0.1.9-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "abb384f4688e5726336412f3969bd95c", "sha256": "e54145583c7d251a9c096d2896d892848afedc1e1542e0e7672173ccbdce7097" }, "downloads": -1, "filename": "colourlovers-0.1.9-py3-none-any.whl", "has_sig": false, "md5_digest": "abb384f4688e5726336412f3969bd95c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10929, "upload_time": "2018-04-22T15:33:52", "url": "https://files.pythonhosted.org/packages/ed/8a/b48e599db17df2f22254ffdc6f6b919f5a0cb4da7a7dd49459aae587ef1e/colourlovers-0.1.9-py3-none-any.whl" } ] }