adafruit / Adafruit_CircuitPython_Requests

Requests-like interface for web interfacing
MIT License
51 stars 36 forks source link

Adding new example for circuitpython requests_https #68

Closed jfabernathy closed 3 years ago

jfabernathy commented 3 years ago

I've been asked to add my example to the directory of example. It's uses requests_https on circuitpython and has been tested on an Adafruit Metro ESP32 Express

ladyada commented 3 years ago

hihi looks like needs a copyright notice at the top, maybe black and pylint - do ya know how to do those?

jfabernathy commented 3 years ago

Sorry not sure what they are or how to fix it now that the code on my end has been committed and pushed. It was amazing that I got that for. I'm guessing that you have a generic copyright that can be inserted. What happen is someone pointed me to an example that wouldn't work and I fixed it. I uploaded that to the forum for anyone interested. Someone asked me to put it on github. Turned out that the example was really for python on a raspberry pi using the blinka library. So here we are. The is where I was told to post the example this time. I was able to fork, clone, add the file commit and push. That's about all this 70 year old can do.

ladyada commented 3 years ago

ha ok @dherrada can help you out with the rest, you're really close!

evaherrada commented 3 years ago

@jfabernathy Ok, so it looks like you're currently failing two of the pre-commit checks.

The first one is the black check. This one is pretty easy to fix. Basically install black with pip install black and then run it in your directory with black --target-version=py35 . .

Now, you also added a file, so you're gonna need to add a license to it. I'd just copy the text from the other example files and change the name to your name and possibly the year if it isn't 2021.

Let me know if you're having any issues getting that to work and I can try to help troubleshoot.

jfabernathy commented 3 years ago

I ran the black program and it reformated but there are no licenses in any of the examples in this directory. There is a MIT license file in the parent directory. Not sure what to do about that

evaherrada commented 3 years ago

@jfabernathy This is the license for examples. Since you're adding a new one that you wrote, replace ladyada with your name (can be either your GitHub name or your actual name). Looks like your fork was made before I added them to this library which makes sense as to why you didn't see them.

# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
jfabernathy commented 3 years ago

after I added the License statements I committed and pushed. It failed again and I finally found out why. pylint really doesn't like my import statements and I have no idea why. The code runs fine.

anecdata commented 3 years ago

@jfabernathy the details of what pylint is failing is here: https://github.com/adafruit/Adafruit_CircuitPython_Requests/pull/68/checks?check_run_id=1826084237 It's not necessarily "right", but you can re-sequence the imports as it suggests and see if that makes it happy.

If that link doesn't work, click on the "Details" below to the right of "Build CI / test (pull_request) Failing after 1m — test".

jfabernathy commented 3 years ago

I've made progress but still failing with one error, exit code 1. So not sure what to do. imports seem fine now.

anecdata commented 3 years ago

I'm not sure about that one, maybe dherrada can advise.

askpatrickw commented 3 years ago

If pre-commit finds anything it will exit that way. https://github.com/adafruit/Adafruit_CircuitPython_Requests/pull/68/checks?check_run_id=1826367683#step:11:24 At that line, you can see that black wanted to reformat a file. One more run of black locally and then commit that file.

Whew... I know. ;-) But you got this !

jfabernathy commented 3 years ago

I ran black again, added, committed, and pushed again. It didn't reject this time. Only good news about this process is it will drive you to drink :-)

evaherrada commented 3 years ago

@jfabernathy Great to see that it's passing!

evaherrada commented 3 years ago

Merging since we've got 2 approvals