adafruit / Adafruit_CircuitPython_PyPortal

CircuitPython driver for Adafruit PyPortal.
MIT License
45 stars 56 forks source link

Update adafruit_pyportal.py #26

Closed DigitalMakerCIC closed 5 years ago

DigitalMakerCIC commented 5 years ago

Added ability to pass headers for authentication typically used by Azure API's

ladyada commented 5 years ago

nice!

lemonkey commented 5 years ago

@DigitalMakerCIC I had a similar requirement where I needed to be able to pass a basic authorization header for my image URL.

Is the format of the headers parameter expecting something like the following?

HEADERS = {"Authorization":"Basic <some token>"}

And do you know if these headers are also used when the image formatter service ultimately calls the image URL to fetch the image and then process it?

Instead of using a data source and image JSON path, I'm using the newer image_url_path property for the image URL.

An update to the example code would be appreciated.

DigitalMakerCIC commented 5 years ago

Hi Details are here in this blog post https://digital-maker.co.uk/adafruit-pyportal-uk-tide-viewer

On 14 May 2019, at 19:48, Ari Braginsky notifications@github.com wrote:

I had a similar requirement where I needed to be able to pass a basic authorization header for my image URL.

Is the format of the headers parameter expecting something like the following?

HEADERS = {"Authorization":"Basic "}

And do you know if these headers are also used when the image formatter service ultimately calls the image URL to fetch the image and then process it?

Instead of using a data source and image JSON path, I'm using the newer image_url_path property for the image URL.

An update to the example code would be appreciated.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/adafruit/Adafruit_CircuitPython_PyPortal/pull/26?email_source=notifications&email_token=AKW5ZI7L7GNLKFTNUT5DR4TPVMCOJA5CNFSM4HHLXHG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVMNSZA#issuecomment-492362084, or mute the thread https://github.com/notifications/unsubscribe-auth/AKW5ZIY5QQOWQNHGQVBLBOTPVMCOJANCNFSM4HHLXHGQ.

lemonkey commented 5 years ago

@DigitalMakerCIC Great thanks for the link!