-
Notifications
You must be signed in to change notification settings - Fork 55
Added ability to pass ESP and SPI objects. #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…calling pyportal to do required qpplication authorization for twitters API
hiya please update to remvoe the version-change, that line is autogenned :)
@brentru wanna take a look?
…On Wed, May 8, 2019 at 11:50 AM Zach Heshelman ***@***.***> wrote:
I needed the ability to use the wifi connection before calling
adafruit_pyportal.py to do required Application authorization for Twitter's
API. Their API requires an access token from a POST request which I get so
I can send adafruit_pyportal.py the GET url with the correct access token
in the headers.
I'm here with you guys at pycon if that helps.
------------------------------
You can view, comment on, or merge this pull request online at:
#33
Commit Summary
- Added ability to pass ESP and SPI objects. Needed to use Wifi before
calling pyportal to do required qpplication authorization for twitters API
File Changes
- *M* adafruit_pyportal.py
<https://github.com/adafruit/Adafruit_CircuitPython_PyPortal/pull/33/files#diff-0>
(34)
Patch Links:
-
https://github.com/adafruit/Adafruit_CircuitPython_PyPortal/pull/33.patch
-
https://github.com/adafruit/Adafruit_CircuitPython_PyPortal/pull/33.diff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#33>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAJINULTROSCP2C2C7EIYWTPULZDJANCNFSM4HLS7GOA>
.
|
I tried to fix the version. I hope I did it right. |
do you ever use |
Yeah, at least I think so. I used spi to define esp before calling the pyportal object. I tried doing it without passing spi but the script failed when it tried to look for the SD card. |
oh right yah its used for SD access |
@ChewyTurtle Heya, the build is failing, see the travis log for details - let me know if you have any Q's: https://travis-ci.com/adafruit/Adafruit_CircuitPython_PyPortal/builds/111126972#L293 |
@brentru I think I fixed the issues from the build failing. I haven't seen that format before but it looked like it was mostly spacing issues. I removed the extra white space and fixed the indentation level. Hopefully that is what was needed. Let me know if it's something else! |
…ional param comments for the two variables added to the init
Looks good, merging in! |
Updating https://github.com/adafruit/Adafruit_CircuitPython_ADS1x15 to 2.0.0 from 1.0.2: > Merge pull request adafruit/Adafruit_CircuitPython_ADS1x15#28 from caternuson/iss26_continuous > Merge pull request adafruit/Adafruit_CircuitPython_ADS1x15#31 from dherrada/master Updating https://github.com/adafruit/Adafruit_CircuitPython_AMG88xx to 1.1.3 from 1.1.2: > Merge pull request adafruit/Adafruit_CircuitPython_AMG88xx#14 from dherrada/master Updating https://github.com/adafruit/Adafruit_CircuitPython_BNO055 to 3.0.6 from 3.0.5: > Merge pull request adafruit/Adafruit_CircuitPython_BNO055#27 from peterhinch/mode-fix > Merge pull request adafruit/Adafruit_CircuitPython_BNO055#25 from peterhinch/issues_23_24 Updating https://github.com/adafruit/Adafruit_CircuitPython_IRRemote to 3.3.2 from 3.3.1: > Merge pull request adafruit/Adafruit_CircuitPython_IRRemote#23 from dherrada/master Updating https://github.com/adafruit/Adafruit_CircuitPython_LIS3DH to 4.3.5 from 4.3.4: > Merge pull request adafruit/Adafruit_CircuitPython_LIS3DH#50 from dherrada/master Updating https://github.com/adafruit/Adafruit_CircuitPython_MAX7219 to 1.2.1 from 1.2.0: > Merge pull request adafruit/Adafruit_CircuitPython_MAX7219#19 from dherrada/master Updating https://github.com/adafruit/Adafruit_CircuitPython_MLX90393 to 1.2.1 from 1.2.0: > Merge pull request adafruit/Adafruit_CircuitPython_MLX90393#9 from dherrada/master Updating https://github.com/adafruit/Adafruit_CircuitPython_MPL3115A2 to 1.1.3 from 1.1.2: > Merge pull request adafruit/Adafruit_CircuitPython_MPL3115A2#5 from dherrada/master Updating https://github.com/adafruit/Adafruit_CircuitPython_MPR121 to 2.0.2 from 2.0.1: > Merge pull request adafruit/Adafruit_CircuitPython_MPR121#18 from dherrada/master Updating https://github.com/adafruit/Adafruit_CircuitPython_PyPortal to 3.0.1 from 3.0.0: > Merge pull request adafruit/Adafruit_CircuitPython_PyPortal#33 from ChewyTurtle/master Updating https://github.com/adafruit/Adafruit_CircuitPython_SI5351 to 1.1.3 from 1.1.2: > Merge pull request adafruit/Adafruit_CircuitPython_SI5351#5 from dherrada/master Updating https://github.com/adafruit/Adafruit_CircuitPython_SSD1306 to 2.6.3 from 2.6.2: > Merge pull request adafruit/Adafruit_CircuitPython_SSD1306#25 from dherrada/master Updating https://github.com/adafruit/Adafruit_CircuitPython_AVRprog to 1.1.3 from 1.1.2: > Merge pull request adafruit/Adafruit_CircuitPython_AVRprog#8 from dherrada/master
Twitter required a specific keyword be in the body. I defined the keyword and it’s value as a string and then passed it with in the get function with the data keyword.
You’ll see my Authorization is in the same format as your example.
POST_DATA = 'grant_type=client_credentials'
TWITTER_POST_URL = 'https://api.twitter.com/oauth2/token'
HEADERS_POST = {
'Host' : 'api.twitter.com',
'User-Agent' : 'PyPortal Twitter Application',
'Authorization' : 'Basic ' + secrets['encode_api_key_secret'],
'Content-Type' : 'application/x-www-form-urlencoded;charset=UTF-8',
'Accept-Encoding' : 'none',
}
wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp32, secrets, status_light)
response = wifi.post(TWITTER_POST_URL, data=POST_DATA, headers=HEADERS_POST)
I’ll be posting my script so far on my GitHub shortly. I’m wanting to make a library, but now that I’m back in the real world I have less time. Hopefully I can work on the library more this weekend.
I hope this helps
Zach
Sent from Mail for Windows 10
From: Ari Braginsky
Sent: Tuesday, May 14, 2019 12:33 PM
To: adafruit/Adafruit_CircuitPython_PyPortal
Cc: Zach Heshelman; Mention
Subject: Re: [adafruit/Adafruit_CircuitPython_PyPortal] Added ability to passESP and SPI objects. (#33)
@ChewyTurtle 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>"}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I needed the ability to use the wifi connection before calling adafruit_pyportal.py to do required Application authorization for Twitter's API. Their API requires an access token from a POST request which I get so I can send adafruit_pyportal.py the GET url with the correct access token in the headers.
I'm here with you guys at pycon if that helps.