Package: cannabis-reports
||||Python Cannabis ReportsThis library allows you to interact with the Cannabis Reports API using Python.Read The API DocumentationTable of ContentsPython Cannabis ReportsInstallationUsageConnectionAPI EndpointsKnown Issues / Road MapCreditsContributorsMaintainerInstallationInstallation is easiest using Pip and PyPi:pip install cannabis-reportsIf you would like to contribute, or prefer Git:git clone https://github.com/LasLabs/python-cannabis-reports.git
cd python-cannabis-reports
pip install .UsageTheCannabisReports objectis the primary point of
interaction with the CannabisReports API.ConnectionConnecting to the CannabisReports API will require an API Key, which is generated from
within your CannabisReports account. In the below example, our key isAPI_KEY.fromcannabis-reportsimportCannabisReportscr=CannabisReports('API_KEY')API EndpointsThe CannabisReports API endpoints are exposed as variables on the instantiatedCannabisReportsobject. The available endpoints are:DispensariesEdiblesExtractsFlowersProducersProductsStrainsThey can also be viewed from the__apis__property ofCannabisReports:>>> cr.__apis__
{'Strains': <CannabisReports.auth_proxy.AuthProxy object at 0x10783ddd0>,
 }API usage is as simple as calling the method with the required parameters and
iterating the results:forstrainincr.Strains.list():print(strain)print(strain.serialize())breakThe output from the above would look something like the below:# This is the Strain object itself (first print)<cannabis-reports.models.strain.Strainobjectat0x10783df10># This is the serialized form of the Strain (second print){'name':'#1K','updated_at':{'datetime':'2015-06-16 22:10:20','timezone':'UTC'},'lineage':[],'qr':'https://www.cannabisreports.com/strain-reports/unknown-breeder/1k/qr-code.svg','seed_company':{'__class__':'SeedCompany','ucpc':'9XVU700000000000000000000','link':'https://www.cannabisreports.com/api/v1.0/seed-companies/9XVU700000000000000000000'},'genetics':{'__class__':'StrainGenetics'},'created_at':{'datetime':'2015-06-16 22:10:20','timezone':'UTC'},'reviews':{'__class__':'GeneralOverview','link':'https://www.cannabisreports.com/api/v1.0/strains/9XVU7PZUEC000000000000000/reviews'},'image':'https://www.cannabisreports.com/images/strains/no_image.png','ucpc':'9XVU7PZUEC000000000000000','__class__':'Strain','url':'https://www.cannabisreports.com/strain-reports/unknown-breeder/1k','children':{'__class__':'GeneralOverview','count':2,'link':'https://www.cannabisreports.com/api/v1.0/strains/9XVU7PZUEC000000000000000/children'},'link':'https://www.cannabisreports.com/api/v1.0/strains/9XVU7PZUEC000000000000000'}In some instances, such as in the case of browsing for a record by its UCPC, a
singleton is expected. In these instances, the singleton is directly used
instead of iterated>>>strain=cr.Strains.get('9XVU7PZUEC000000000000000')>>>strain<cannabis-reports.models.strain.Strainobjectat0x101723e50>>>>strain.serialize(){'name':'#1K','updated_at':{'datetime':'2015-06-16 22:10:20','timezone':'UTC'},'lineage':[],'qr':'https://www.cannabisreports.com/strain-reports/unknown-breeder/1k/qr-code.svg','seed_company':{'__class__':'SeedCompany','ucpc':'9XVU700000000000000000000','link':'https://www.cannabisreports.com/api/v1.0/seed-companies/9XVU700000000000000000000'},'genetics':{'__class__':'StrainGenetics'},'created_at':{'datetime':'2015-06-16 22:10:20','timezone':'UTC'},'reviews':{'__class__':'GeneralOverview','link':'https://www.cannabisreports.com/api/v1.0/strains/9XVU7PZUEC000000000000000/reviews'},'image':'https://www.cannabisreports.com/images/strains/no_image.png','ucpc':'9XVU7PZUEC000000000000000','__class__':'Strain','url':'https://www.cannabisreports.com/strain-reports/unknown-breeder/1k','children':{'__class__':'GeneralOverview','count':2,'link':'https://www.cannabisreports.com/api/v1.0/strains/9XVU7PZUEC000000000000000/children'},'link':'https://www.cannabisreports.com/api/v1.0/strains/9XVU7PZUEC000000000000000'}Note that all of the API responses will be parsed, with proper objects being
created from the results. The objects are all defined in thecannabis-reports.models
package.Known Issues / Road MapThis ReadMe could use workMore testing on the endpoints. Kept getting rate limited and have not yet received
and API key.CreditsMost of the doc strings were taken directly from theCannabis
Reports API DocumentationContributorsDave Lasley <dave@laslabs.com>MaintainerThis module is maintained by LasLabs Inc.