juangallostra / colourlovers-api-wrapper Goto Github PK
View Code? Open in Web Editor NEWPython wrapper for the API provided by www.colourlovers.com
License: MIT License
Python wrapper for the API provided by www.colourlovers.com
License: MIT License
cl = clapi.ColourLovers()
pattern = cl.search_patterns(request='random')[0]
KeyError: 'request'
'new' and 'top' return correct result
The README does not list the extra methods (such as draw
) available in some of the container objects obtained after a request.
This methods are listed and demonstrated in the README.
Setup:
python3 -m venv .env
.env/bin/pip install --upgrade pip
.env/bin/pip install colourlovers
Then run .env/bin/python script.py
with
from colourlovers import clapi
cl = clapi.ColourLovers()
for type in ['new', 'top', 'random']:
print(type)
print(cl.search_palettes(request=type, numResults=1))
This prints
new
[<colourlovers.data_containers.Palette object at 0x7f33644cad60>]
top
[<colourlovers.data_containers.Palette object at 0x7f3362fcec10>]
random
Traceback (most recent call last):
File "./script.py", line 8, in <module>
print(cl.search_palettes(request=type, numResults=1))
File "./.env/lib/python3.8/site-packages/colourlovers/clapi.py", line 237, in _api_search
processed_request = self.__process_optional_requests(search_type, **kwargs)
File "./.env/lib/python3.8/site-packages/colourlovers/clapi.py", line 402, in __process_optional_requests
del kwargs[valid_keyword]
KeyError: 'request'
So, new
and top
searches work, but random
fails.
cl.search_palettes(request="random", numResults=1)
should return a list containing one random Palette
object.
Show in the readme some usage examples of how the API is used
It is hard to import the API wrapper. Currently, to import the wrapper one has to:
from colourlovers_api import wrapper
cl = wrapper.ColourLovers()
The API wrapper can be easily imported and with names that make sense.
When searching by pattern
or palette
the API accepts as a valid parameter a patternID
or paletteID
respectively. The wrapper doesn't currently support specifying IDs for pattern
and palette
searches. The same goes with lover
and the parameter username
and color
and the parameter hexvalue
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.