/ OSHWA_Submitter / submitter.py
submitter.py
 1  # SPDX-FileCopyrightText: 2020 Eva Herrada for Adafruit Industries
 2  #
 3  # SPDX-License-Identifier: MIT
 4  
 5  import requests
 6  
 7  token = "TOKEN_GOES_HERE"
 8  
 9  url = "https://certificationapi.oshwa.org/api/projects"
10  
11  responsiblePartyType = "Company"
12  responsibleParty = "Adafruit Industries, LLC"
13  bindingParty = "Limor Fried"
14  country = "United States of America"
15  streetAddress1 = "150 Varick St."
16  streetAddress2 = ""
17  city = "New York"
18  state = "New York"
19  postalCode = "10013"
20  privateContact = "oshw@adafruit.com"
21  publicContact = "oshw@adafruit.com"
22  projectName = "Adafruit QT Py = SAMD21 Dev Board with STEMMA QT"
23  projectWebsite = "https://www.adafruit.com/product/4600"
24  projectVersion = "Rev C"
25  previousVersions = "[]"
26  projectDescription = "This diminutive dev board comes with our favorite lil chip, the SAMD21. OLEDs! Inertial Measurement Units! Sensors a-plenty. All plug-and-play thanks to the innovative chainable design: SparkFun Qwiic-compatible STEMMA QT connectors for the I2C bus so you don't even need to solder. It also has 11 GPIO pins and a built-in NeoPixel RGB LED. This board ships with CircuitPython but also works great with Arduino."
27  primaryType = "Electronics"
28  additionalType = '[ "Electronics"]'
29  projectKeywords = f'[ "{projectName}", "CircuitPython"]'
30  documentationUrl = "https://learn.adafruit.com/adafruit-qt-py"
31  hardwareLicense = "Other"
32  softwareLicense = "MIT"
33  documentationLicense = "CC BY-SA"
34  relationship = "PROJECT IS DESIGNED AND DISTRIBUTED BY ADAFRUIT INDUSTRIES"
35  
36  payload = f'{{"responsiblePartyType": "{responsiblePartyType}","responsibleParty": "{responsibleParty}","bindingParty": "{bindingParty}","country": "{country}","streetAddress1": "{streetAddress1}","streetAddress2": "{streetAddress1}","city": "{city}","state": "{state}","postalCode": "{postalCode}","privateContact": "{privateContact}","publicContact": "{publicContact}","projectName": "{projectName}","projectWebsite": "{projectWebsite}","projectVersion": "{projectVersion}","previousVersions": {previousVersions},"projectDescription": "{projectDescription}","primaryType": "{primaryType}","additionalType": {additionalType},"projectKeywords": {projectKeywords},"citations": [{{}}],"documentationUrl": "{documentationUrl}","availableFileFormat": true,"hardwareLicense": "{hardwareLicense}","softwareLicense": "{softwareLicense}","documentationLicense": "{documentationLicense}","noCommercialRestriction": true,"noDocumentationRestriction": true,"openHardwareComponents": "true","creatorContribution": true,"noUseRestriction": true,"redistributedWork": true,"noSpecificProduct": "true","noComponentRestriction": true,"technologyNeutral": true,"certificationMarkTerms": {{ "accurateContactInformation": {{ "term": "I have provided OSHWA with accurate contact information, recognize that all official communications from OSHWA will be directed to that contact information, and will update that contact information as necessary.", "agreement": true }}}},"explanationCertificationTerms": "N/A (I agree to all terms)","relationship": "{relationship}","agreementTerms": true,"parentName": ""}}'
37  print(payload)
38  
39  headers = {"Content-Type": "application/json", "Authorization": f"Bearer {token}"}
40  
41  r = requests.request("POST", url, headers=headers, data=payload)
42  
43  print("\n")
44  print(r.status_code)
45  print("\n")
46  print(r.json())