IRC logs for #farmOS, 2019-08-19 (GMT)

2019-08-18
2019-08-20
TimeNickMessage
[21:42:08]* JustTB has quit (Ping timeout: 245 seconds)
[03:12:59]* JustTB has joined #farmos
[03:40:19]* JustTB has quit (Quit: Leaving.)
[04:33:47]* JustTB has joined #farmos
[07:58:06]<skipper_is[m]>Yea, I've been using that, dunno where I got 2 from, as that was the vocab for animals..
[08:00:33]<skipper_is[m]>https://github.com/Skipper-is/SMS-Egg-Logger
[08:00:49]<skipper_is[m]>I've refactored it all, so it is a bit neater, and better documented
[08:01:30]<mstenta[m]>Awesome!!
[08:01:43]<mstenta[m]>That's really cool @skipper_is:matrix.org
[08:02:06]<mstenta[m]>We should add a link to that somewhere on farmOS.org perhaps
[08:02:51]<mstenta[m]>It would be great to get better organized about linking to projects and solutions in the farmOS community
[08:07:52]<skipper_is[m]>I should remake it for C++, but I can't find a straightforward solution to string arrays...
[08:08:51]<skipper_is[m]>It is a bit pointless running an entire MicroPython stack for just that, but it works!
[08:09:38]<mstenta[m]>@donblair:matrix.org: has been using micro Python
[08:10:02]<mstenta[m]>Sounds pretty nice
[08:10:32]<skipper_is[m]>I've always looked down on Python.. Like it was just a tinkering language, but it is just so handy! I always seem to come back to it!
[08:11:03]<mstenta[m]>I've only just recently started using it and I love it
[08:11:33]<skipper_is[m]>I know, it is just so easy to learn and implement
[08:11:41]<mstenta[m]>Languages get you where you need to go :-)
[08:11:55]<skipper_is[m]>Indeed!
[08:12:10]<mstenta[m]>"first make it work" :-)
[08:12:34]<mstenta[m]>Then you can make it "right" or "fast" or whatever if/when you need to
[08:13:00]<skipper_is[m]>Yea, and to be fair, it doesn't need to be fast in this case, how often do you collect eggs? Like 2x a day tops...
[08:13:11]<skipper_is[m]>Not needing microsecond accuracy
[08:13:11]<mstenta[m]>Right exactly!
[08:13:31]<mstenta[m]>No need for premature optimization in this case :-)
[08:14:20]<skipper_is[m]>I'll have to figure out an elegant way of sending milk readings, does the farmOS json files accept queries of any kind? Like can I ask for "cattle with an ID like ...2345"?
[08:14:36]<skipper_is[m]>Eartag Id, rather than the db id..
[08:17:03]<skipper_is[m]>I can use /farm_asset.json?type=animal but that just fetches the whole lot, &name=...bob seems to work.. Will have to have a play
[08:17:41]<skipper_is[m]>Just don't fancy having to parse the entire JSON on the microcontroller
[08:21:14]<mstenta[m]>Hmm I forget
[08:21:40]<mstenta[m]>I don't think you can query by id tag at the moment
[08:21:52]<mstenta[m]>Because that is stored in a field collection
[08:21:54]<mstenta[m]>https://farmos.org/development/api/#animal-id-tags
[08:22:29]<mstenta[m]>There's a to-do to move away from using field collections because of that reason (doesn't work great with API)
[08:22:35]<skipper_is[m]>Yea, I think the only way I could do it with less client side processing would be to narrow it down by species
[08:22:46]<skipper_is[m]>Then parse and process that lot client side
[08:22:51]<mstenta[m]>Ah yea
[08:23:22]<skipper_is[m]>But if someone has 200 cattle, probably not feasable, but then they probably wouldn't be trying to text their milk yields...
[08:23:30]<mstenta[m]>So one thing to consider: you could create a custom endpoint on the farmOS server itself
[08:23:37]<mstenta[m]>In a custom module
[08:23:42]<skipper_is[m]>Personally. No :P
[08:23:50]<mstenta[m]>Which takes exactly the parameters you want
[08:24:20]<skipper_is[m]>I imagine someone could! I can just about add an extra parameter to a map, but that is about it so far!
[08:24:28]<mstenta[m]>Then your Python logic would be simpler
[08:24:48]<mstenta[m]>Essentially just a relay to that endpoint
[08:25:00]<mstenta[m]>Menu callbacks are pretty simple in Drupal
[08:25:03]<skipper_is[m]>Yea, but I've not even looked at how endpoints are defined...
[08:25:13]<mstenta[m]>hook_menu
[08:25:59]<skipper_is[m]>and rest can hook into any hook_menu?
[08:26:23]<mstenta[m]>You could look at the one that creates /farm.json as a relatively simple example
[08:27:00]<mstenta[m]>With a custom endpoint you handle parsing the request and returning json yourself
[08:27:17]<mstenta[m]>It doesn't use the REST module at all
[08:27:19]<skipper_is[m]>Yea, which could take some slightly more fuzzy parameters
[08:27:52]<skipper_is[m]>I'l have to have a look... At one point, starting my new job in a weeks time, so it'll have to wait... Need to move house first too...
[08:28:17]<mstenta[m]>Cool! Let me know if you need any pointers! :-)
[08:28:51]<skipper_is[m]>Yea, definitely will do!
[08:47:13]<donblair[m]>Oh, this egg poster is brilliant :)
[08:47:33]<donblair[m]>I had no idea there was a design combining the ESP32 and the SIM800 -- that's brilliant!
[08:48:05]<donblair[m]>I was using the same hardware combination myself but hacked together
[08:50:11]<donblair[m]>I'm using the SIM800 to do an HTTP GET to my own server, which then relays the info via a POST to FarmOS
[08:50:44]<donblair[m]>Thanks for posting your code, skipper_is -- it's much better-structured than mine, inspiring
[08:51:38]<donblair[m]>+100 for the ease of use of Micropython / Circuitpython -- especially when handling strings :)
[08:52:48]<donblair[m]>And I think it's true: for most applications in environmental monitoring / actuation / agriculture, I can't imagine one would run into speed limitations in Micropython / Circuitpython ...
[08:53:43]<donblair[m]>... and it makes the tech so much more accessible for so many more people
[10:00:48]<skipper_is[m]>Yea, I know! Odd that I couldn't make direct post requests to FarmOS, but had to echo them through an extra PHP page...
[10:01:50]<mstenta[m]>Oh so was there an issue posting directly?
[10:06:50]<skipper_is[m]>Yea, when I did a get it was fine
[10:07:01]<skipper_is[m]>But when I posted, not so much!
[10:07:28]<skipper_is[m]>Got a bunch of weird bytes...
[10:07:38]<mstenta[m]>Huh strange
[10:07:48]<mstenta[m]>And that's only when the request was made via Micropython?
[10:07:54]<skipper_is[m]>Yup
[10:07:59]<mstenta[m]>You experienced that too donblair ?
[10:08:06]<skipper_is[m]>Same request through Postman no problems
[10:10:49]<skipper_is[m]>I didn't have time to poke around and try and find the source of the problem, but I'll have another go tonight
[10:11:13]<mstenta[m]>No worries - just curious if it was a farmOS issue
[10:11:48]<skipper_is[m]>Yea, no idea.. it was a 404 code, but not my usual 404 page...
[10:12:07]<skipper_is[m]>It was just a weird bunch of bytes...
[10:12:43]<skipper_is[m]>And Changing post to get, no 404!
[10:13:23]<mstenta[m]>How are you authenticating?
[10:13:31]<skipper_is[m]>Basic
[10:13:36]<mstenta[m]>Ah gotcha
[10:14:25]<skipper_is[m]>Also annoying that MicroPython doesn't have a base64 encode function .
[10:16:13]<skipper_is[m]>Is basic preferred, or token?
[10:16:55]<mstenta[m]>When you say "basic" do you mean you installed the basic authentication module for restws?
[10:17:35]<mstenta[m]>That works fine, but is not available on Farmier hosted sites
[10:18:04]<mstenta[m]>The farmOS.py and farmOS.js libraries authenticate with Drupal username and password, and store the cookie and restws token
[10:18:17]<mstenta[m]>I'm eager to implement Oauth2 as a next step
[10:20:14]<skipper_is[m]>@donblair:matrix.org: you seen this? https://store.rakwireless.com/products/rak7200-lora-tracker?_pos=1&_sid=...
[10:20:14]<paul121[m]>I wanted to a ask, I'm not too familiar with micropython.... But is farmOS.py not compatible?
[10:20:36]<paul121[m]>But very cool @skipper_is:matrix.org !!!
[10:21:16]<mstenta[m]>Oh good question paul121
[10:21:28]<mstenta[m]>I assume not... but maybe it is
[10:21:59]<skipper_is[m]><paul121[m] "I wanted to a ask, I'm not too f"> I've not looked at farmOS.py
[10:22:24]<mstenta[m]>Ah! Might find it useful!
[10:22:25]<mstenta[m]>https://github.com/farmOS/farmOS.py
[10:22:36]<mstenta[m]>Although might not work on micropython
[10:23:05]<skipper_is[m]>I'll give it a spin, but I think there are some dependencies that aren't available on MicroPython
[10:23:54]<mstenta[m]>Oh paul121 ! You might be interested in skipper_is 's project...
[10:23:55]<mstenta[m]>Allows posting egg harvests via text :-)
[10:24:40]<paul121[m]>Yes! Just finished the README! Wish I had it for when I collect eggs tomorrow!!
[10:24:43]<mstenta[m]>skipper_is: you should post this to the farmOS forum too... doesn't have to be a long post or anything ... just so that folks who are browsing over there are aware of it
[10:24:55]<skipper_is[m]>Not that many dependencies for FarmOS.py, so it might work, requests isn't available, but there is a micro- version of it that may be similar
[10:25:11]<mstenta[m]>Hmm maybe we need a micro-farmOS.py ;-)
[10:25:24]<skipper_is[m]>I can have a look at porting it
[10:25:29]<paul121[m]>> Hmm maybe we need a micro-farmOS.py ;-)
[10:26:17]* farmBOT has joined #farmos
[10:26:26]<paul121[m]>What is farmBOT btw?
[10:26:29]<mstenta[m]>Usually jgaehring 's responsible for that
[10:26:37]<mstenta[m]>farmBOT: hello
[10:26:38]<paul121[m]>Haha
[10:26:53]<mstenta[m]>farmBOT: hello
[10:27:00]<mstenta[m]>Hmm :-(
[10:27:10]<mstenta[m]>farmBOT is an IRC bot that does not like emojis
[10:27:22]<mstenta[m]>And doesn't seem to be responding at all right now
[10:27:24]<jgaehring[m]>hahaha
[10:28:09]* mstenta has joined #farmos
[10:28:26]<mstenta>farmBOT: hello
[10:28:38]<mstenta>hello
[10:29:03]<mstenta[m]>oh well... ¯\_(ツ)_/¯
[10:29:14]* mstenta has quit (Client Quit)
[10:30:38]<skipper_is[m]>Or doesn't like metal...
[10:31:43]<paul121[m]>RIP
[10:33:28]<paul121[m]>Well, @skipper_is:matrix.org, getting farmOS.py to work on micropython would be way cool. Let us know if you have any questions on the farmOS.py side
[10:33:48]<paul121[m]>I might need to get some hardware.. is there a good board you recommend for development?
[10:38:17]<skipper_is[m]>I like the ESP32 modules, as you can get LoRa ones, and ones with sim cards etc
[10:39:16]<skipper_is[m]>Just about any variant of esp32 you can imagine is available on Banggood...
[10:40:57]<skipper_is[m]>Or the MicroPython PyBoard, if you want to go OEM
[10:43:29]<paul121[m]>Cool! I learned of micropython from PyBoard but imagined there was other hardware as well.
[10:44:16]<paul121[m]>Lots of possibilities.. SMS logging wouldn't have passed my mind! So cool!
[10:44:22]<paul121[m]>What was your motivation?
[10:47:28]<skipper_is[m]>I want to see if I can port the base64 module as well... Would be very handy having that in built into my egg logger
[10:47:57]<skipper_is[m]>I'm about to take on a small farm, which has a bunch of chickens
[10:48:28]<skipper_is[m]>At the moment they're just logging eggs on a sheet of paper, but what happens to that info.. no one could tell me...
[10:49:34]<paul121[m]>> At the moment they're just logging eggs on a sheet of paper, but what happens to that info.. no one could tell me...
[10:50:18]* farmBOT has joined #farmos
[10:50:21]<paul121[m]>Sorry!!
[10:50:29]<mstenta[m]>haha
[10:50:36]<skipper_is[m]>They're a bit technophobic too (biodynamic farm...) So I didn't want to make them use the full smartphone app yet
[10:51:09]<skipper_is[m]>And SMS is pretty accessible to even the most technophobic person
[10:51:15]<paul121[m]>Totally. SMS is a great solution
[10:51:40]<paul121[m]>Also it's easy on board new people. Without having to teach the full farmOS app and ecosystem
[10:52:01]<skipper_is[m]>Exactly
[10:52:05]<mstenta[m]>It's also a step towards voice recognition! Most phones let you speak texts
[10:52:22]<skipper_is[m]>Yea, but I am imagining them to have like Nokia 3310s...
[10:52:43]<skipper_is[m]>Oooo...voice recognition on MicroPython.....
[10:52:50]<skipper_is[m]>Probably not powerful enough.
[10:53:07]<mstenta[m]>skipper_is: I could see this turning into a general purpose farmOS logging component :-)
[10:53:14]<skipper_is[m]>XD
[10:53:22]<mstenta[m]>The trick with voice recog is that you first need to be able to understand the text
[10:53:30]<paul121[m]>We need to create an SMS API
[10:53:44]<skipper_is[m]>Need to figure out the fuzzy logic with the field names etc first..
[10:53:50]<mstenta[m]>So by developing some standard farmOS text commands, it's an easy next step to voice recog
[10:53:58]<mstenta[m]>Yes exactly - that's the real work
[10:54:16]<mstenta[m]>But if we just had a set of accepted commands... that could be a start
[10:54:23]<mstenta[m]>And some built in assumptions
[10:54:26]<skipper_is[m]>Yea, like 5 eggs... :)
[10:54:43]<mstenta[m]>Yea simple!
[10:54:44]<skipper_is[m]>Just find whatever numbers are there if you've said the word egg on there XD
[10:54:53]<mstenta[m]>"Harvest [qty] [units] from [planting name]"
[10:55:15]<skipper_is[m]>I need to look more closely at that sometime... It'll be happy to take 5 eggs 23 as 523 eggs..
[10:55:31]<mstenta[m]>And even if it returned "Command not recognized"... at least you have it recorded! And you can go fix it later that night
[10:55:39]<mstenta[m]>Better than just forgetting it into the ether of your brain haha
[10:55:43]<skipper_is[m]>True
[10:56:04]<skipper_is[m]>Could even post the voice command as a file to the actual log
[10:56:21]<mstenta[m]>Yea!
[10:56:30]<mstenta[m]>logs have a "data" field
[10:56:32]<mstenta[m]>that is hidden
[10:56:36]<skipper_is[m]>Are births coming to the app soon?
[10:56:41]<mstenta[m]>but could be useful for this maybe
[10:56:53]<mstenta[m]>brb - phone call...
[10:56:56]<skipper_is[m]>Does that correspond to the file/photo section?
[10:56:57]<paul121[m]>Wow cool ideas!
[10:57:24]<skipper_is[m]>Also, what do you guys record for deaths in FarmOS proper?
[10:58:05]<paul121[m]>I don't believe the `data` field corresponds to file/photo
[10:58:32]<skipper_is[m]>Ah ok, so is it accessible later on? Or only through the api
[10:58:33]<paul121[m]>It's more of a general purpose space to dump data
[10:58:34]<mstenta[m]>> Does that correspond to the file/photo section?
[10:58:35]<mstenta[m]>No it's a separate text field that arbitrary data can be stored to, like XML/JSON/etc
[10:58:47]<mstenta[m]>Only through API currently
[10:59:40]<skipper_is[m]>Might be better to store the voice command in the files section, so you can check it through FarmOS proper
[11:04:42]<skipper_is[m]>Also, in the app, can equipment be searchable like assets?
[11:04:54]<skipper_is[m]>Got a big long list of equipment....
[11:08:29]<paul121[m]>> Might be better to store the voice command in the files section, so you can check it through FarmOS proper
[11:08:29]<paul121[m]>I agree!
[11:10:10]<paul121[m]>> Also, in the app, can equipment be searchable like assets?
[11:10:11]<paul121[m]>I'm not sure... On my phone and can't pull up a test right now
[11:10:11]<skipper_is[m]>Plus you could use the same functionality if you're doing a field walk for example
[11:11:03]<skipper_is[m]>ACTION uploaded an image: Screenshot_20190819-161047_Chrome.jpg (354KB) < https://matrix.org/_matrix/media/v1/download/matrix.org/wxLPLfmICwQxNicd... >
[11:11:04]<skipper_is[m]>Assets are like this
[11:11:28]<skipper_is[m]>ACTION uploaded an image: Screenshot_20190819-161115_Chrome.jpg (337KB) < https://matrix.org/_matrix/media/v1/download/matrix.org/APEOUHonbZfuRDSD... >
[11:11:28]<skipper_is[m]>Equipment like this...
[11:11:58]<paul121[m]>Ahhh I see. I thought you meant browser based farmOS! That's a good question for @jgaehring:matrix.org
[11:12:04]<skipper_is[m]>No, sorry :)
[11:12:27]<skipper_is[m]>The search is much easier!
[11:12:39]<paul121[m]>Good to know!
[11:13:26]<paul121[m]>Maybe it could be a UI option? If you have few equipment/assets, it displays the dropdown, or you can choose a search?
[11:14:08]<skipper_is[m]>Yea, I guess that's work, search is really quick
[11:16:41]<jgaehring[m]>> Also, in the app, can equipment be searchable like assets?
[11:16:42]<jgaehring[m]>that shouldn't be too hard, come to think of it I'm a little surprised we didn't do that in the first place
[11:20:57]<jgaehring[m]>do you want to open an issue in https://github.com/farmOS/farmOS-client/issues, skipper_is ?
[11:24:59]<skipper_is[m]>Done
[11:55:47]<skipper_is[m]>Doesn't look like the MicroPython port of FarmOS.py will be that hard, there are libraries for most of the dependencies (well, urllib.parse so far)
[12:18:36]<paul121[m]><skipper_is[m] "Doesn't look like the MicroPytho"> Great
[12:19:43]<paul121[m]>Yeah, I'm looking at it now, I think `requests` and `urllib.parse` might be the only dependencies
[12:20:29]<paul121[m]>And `urllib.parse` isn't used all too much, just to make parsing url's easier. That could be changed if we needed
[12:20:48]<paul121[m]>(changed for a micro-pyton port)
[12:37:20]<skipper_is[m]>Urequests is built in and may have what we need
[12:37:57]<skipper_is[m]>Collections.defaultdict
[12:38:51]<skipper_is[m]>I've not yet looked at the code, just tried to import it and fight the fires as they arise
[12:39:34]<skipper_is[m]>After supper I'll have some time to poke around properly
[13:44:02]<paul121[m]>Excited to hear what you find
[13:44:13]<paul121[m]>@skipper_is:matrix.org: !
[13:46:05]<skipper_is[m]>So far I've found that Micropython hates modules with capital letters..
[13:46:10]<skipper_is[m]>FarmOS has become farmos
[13:47:17]<paul121[m]>Hmm interesting
[13:47:33]<skipper_is[m]>Very odd..
[13:47:44]<skipper_is[m]>Because I'm sure I've had modules with capital letters in before..
[13:47:49]<skipper_is[m]>It does just seem to be picky sometimes
[13:48:22]<skipper_is[m]>It didn't like egg_poster either, but was happy with eggposter...
[13:48:38]<skipper_is[m]>But it is fine with parse_qs
[13:48:45]<skipper_is[m]>Temperamental, that is what it is
[13:50:53]<skipper_is[m]>And it is happy with import urllib.parse
[13:51:13]<skipper_is[m]>But import urllib.parse as steve
[13:51:19]<skipper_is[m]>AttributeError: 'module' object has no attribute 'parse'
[13:53:20]<skipper_is[m]>I think I might have more luck rebuilding it from scratch...
[13:53:39]<skipper_is[m]>Am going to shamelessly copy and paste blocks of code though
[13:58:55]<skipper_is[m]>Wow, it really is temperamental... I created a blank farmOS.py file, and it imports just fine...
[13:58:58]<skipper_is[m]>Useless thing.....
[13:59:28]<skipper_is[m]>Maybe it was just silently unhappy about the dependencies
[14:01:52]<paul121[m]>Hmmm yeah
[14:02:53]<paul121[m]>I'm curious if you replace the `requests` dependecy with the `urequests` ?
[14:03:50]<skipper_is[m]>urequests lacks Sessions
[14:04:12]<skipper_is[m]>So session.py is going to need rewriting anyway
[14:06:14]<paul121[m]>Ah ok. Thats not too bad then. I think you would just need to rewrite the `APISession` class
[14:06:26]<skipper_is[m]>Yea, looking at that one now
[14:07:45]<paul121[m]>(I believe) `sessions.py` just uses `request.session` to save cookies for authentication
[14:08:29]<skipper_is[m]>Ah okay, I'm still going through the functions to figure out what is what
[14:08:46]<paul121[m]>Let me know if you have any questions
[14:08:48]<skipper_is[m]>Yea, it is getting the token in authenticate
[14:10:22]<skipper_is[m]>The token is stored in the Session cookies?
[14:10:45]<skipper_is[m]>No.. its stored in self.token...
[14:12:09]<paul121[m]>Yeah, right here: https://github.com/farmOS/farmOS.py/blob/c263fd96adb539896c6e1cf66519730...
[14:12:37]<skipper_is[m]>So... I can't figure out why Sessions is involved...
[14:12:58]<paul121[m]>I'm going to try it real quick without Sessions
[14:13:18]<skipper_is[m]>I've removed too much for it to work in Python3 XD
[14:14:38]<skipper_is[m]>I can't quite see what sessions is doing, as the token is stored in the class instance
[14:15:40]<paul121[m]>Right. I can't remember for sure if `requests.sessions` automatically handles some of the cookies in the background
[14:15:54]<paul121[m]>Setting up authentication was a little tricky
[14:18:32]<skipper_is[m]>Well, it doesn't work straight off...
[14:18:45]<skipper_is[m]>class APISession(requests):
[14:18:46]<skipper_is[m]>TypeError: module() takes at most 2 arguments (3 given)
[14:20:05]<paul121[m]>Right :/
[14:20:44]<skipper_is[m]>Without requests in the class, it works... to a point
[14:20:57]<skipper_is[m]>And that point is farmOS.authenticate
[14:21:34]<paul121[m]>-- The Session object allows you to persist certain parameters across requests.
[14:21:35]<paul121[m]>from the documentation
[14:21:49]<paul121[m]>So by using the `requests.session` object, it makes things much simpler :)
[14:22:12]<skipper_is[m]>Well, it looks like we might have to go more complex...
[14:24:14]<skipper_is[m]>Ah, the only use I could find of it was in http_request
[14:24:25]<skipper_is[m]>it calls self.request, but requests.request should do the job
[14:24:44]<skipper_is[m]>...should
[14:25:04]<paul121[m]>Yeah, you just have to pass credentials/cookies/tokens to the `self.request(args)` call each time
[14:25:15]<paul121[m]>Using HTTP Basic Auth this isn't so hard
[14:25:26]<skipper_is[m]>Way easier for me XD
[14:25:35]<paul121[m]>That is what the `requests.session` handles
[14:25:38]<skipper_is[m]>But would require a base64 module
[14:25:57]<skipper_is[m]>Unless you fancy porting requests.session
[14:26:29]<paul121[m]>remind me what base64 is need for again? I think I missed that from earlier
[14:27:27]<skipper_is[m]>Basic Authentication in the header looks like "Autherization: basic asdasfjsdfkjsdflkasd"
[14:27:31]<skipper_is[m]>Or words to that effect
[14:27:47]<skipper_is[m]>aslkdjasjfhfkjhas part is the "username:password" encoded in base64
[14:28:00]<paul121[m]>ahhhh yes. I see where this is going :)
[14:28:38]<skipper_is[m]>for example, if my username is skipper, and my password is FarmOS, my asdjhasjkknf part would look like c2tpcHBlcjpGYXJtT1M=
[14:28:51]<skipper_is[m]>So we can just encode the username/password and stick it in the header
[14:29:00]<paul121[m]>right
[14:29:20]<mstenta[m]>could you put them in the URL instead?
[14:29:28]<skipper_is[m]>Don't think it works
[14:29:39]<skipper_is[m]>I've not tried to be honest... but I don't think you can have it as a url parameter
[14:29:42]<mstenta[m]>eg: https://user:pass@myfarmos.org
[14:29:51]<skipper_is[m]>Oo dunno.... maybe then...
[14:30:01]<mstenta[m]>https://stackoverflow.com/questions/2716990/http-basic-authentication-cr...
[14:30:03]<skipper_is[m]>I thought you meant like ?username=
[14:30:36]<skipper_is[m]>Depreciated in 2005...
[14:30:37]<mstenta[m]>worth a try!
[14:30:52]<mstenta[m]>not sure if it's supported in all http libs
[14:31:08]<paul121[m]>Just looked at your code skipper_is , I see you hard coded the base64 user/pass
[14:31:12]<paul121[m]>I understand now!
[14:31:13]<skipper_is[m]>Yea, will have to look urequests is a bit finicky about just about everything, but we can try it
[14:31:27]<skipper_is[m]>Yea, initial version used base64.encode()
[14:31:34]<skipper_is[m]>but it isn't ported to micropyhton
[14:31:39]<skipper_is[m]>*python
[14:32:09]<mstenta[m]>oh didn't know https://[user]:[pass]@[domain]/ was deprecated
[14:32:23]<mstenta[m]>even so... if it still works.... would make things easier
[14:32:26]<skipper_is[m]>Neither did I
[14:32:35]<skipper_is[m]>https://stackoverflow.com/questions/2716990/http-basic-authentication-cr...
[14:33:13]<skipper_is[m]>Nope, wrong one..
[14:33:29]<skipper_is[m]>Very old question but nevertheless: this approach has been deprecated by ietf.org/rfc/rfc3986.txt: "Use of the format "user:password" in the userinfo field is deprecated." – Madbreaks Feb 13 at 20:14
[14:33:30]<skipper_is[m]>That... anyway
[14:33:46]<skipper_is[m]>There is a micropython port actually of base64
[14:34:25]<skipper_is[m]>but I was going to try and keep mine additional dependency free, so it was really simple to use
[14:34:45]<skipper_is[m]>I'm not sure if micropython works with setup.py...
[14:36:32]<skipper_is[m]>ACTION sent a long message: < https://matrix.org/_matrix/media/v1/download/matrix.org/tDmSmstIILAwcTLj... >
[14:37:13]<skipper_is[m]>Hmm.... session is now struggling with a https address...
[14:38:27]<skipper_is[m]>That is it, I'm rolling my own..
[14:39:26]<paul121[m]>This might be of interest: https://github.com/lucien2k/wipy-urllib
[14:40:06]<mstenta[m]>skipper_is: hmm not sure but IIRC donblair ended up moving to ESP32 partly because ESP8266 couldn't do HTTPS
[14:40:40]<paul121[m]>Another `urequests` that might support Cookies and Basic Auth
[14:43:21]<skipper_is[m]>I don't think the ESP8266 has the SSL module
[14:44:07]<skipper_is[m]>I've got an 8266, I'll try it out at one point, but I know they cut the networking back a bit on that board because of size limits
[14:44:27]<skipper_is[m]>I want to avoid external libraries, just for ease of use really..
[14:45:01]<mstenta[m]>yea that sounds like what Don described
[14:45:29]<skipper_is[m]>I might also flatten everything down into 1 file to upload to the board, just so it is just upload and go operation
[14:48:47]<paul121[m]>Totally. If you can get it working thats a great starting point
[14:48:54]<paul121[m]>Then maybe clean it up from there
[14:49:09]<skipper_is[m]>Yea, well I'm wrestling with Python accepting 2 classes in one file at the moment XD
[14:49:59]<skipper_is[m]>Oh, open bracket...
[14:50:26]<paul121[m]>haha good luck :D
[15:15:26]<skipper_is[m]>So, a bit more digging, and I've figured out the cookies and token side... I've not done much with OAuth, so was all new to me, and basically, unless we use an external library to keep cookies, we're stuck with basic authentication
[15:56:28]<skipper_is[m]>Right... so I chickened out... I'm going to try and roll everything in to one, a new version of urequests with cookies, and a base64 encoder
[16:06:11]<skipper_is[m]>It is especially annoying as the urequests library built in receives the cookies, but doesn't make them visible or anything....If it just made all the raw data available would be nice!
[16:31:19]<skipper_is[m]>@donblair:matrix.org: how do you deploy to MicroPython?
[16:48:57]<donblair[m]>Hi skipper_is -- apologies that I haven't fully been following the thread here, so not sure if this will address any issues you're having -- but I'm using an ESP32 with the latest ESP32 release of Micropython, and the following code to post to FarmOS (this example uses a DHT22 temp + humidity sensor) https://github.com/edgecollective/quahog-quickstart/blob/master/farmos/f...
[17:06:58]<skipper_is[m]>Ah ok, so you upload those 3 files, then launch f.py on boot?
[17:19:47]<donblair[m]>Oh, sorry my code is disorganized -- it's actually just that one file, "farmos_post_dht22.py", as a simple example of posting to FarmOS ... the other files are modifications of it :)
[17:20:32]<donblair[m]>If I recall, none of the "import" statements require any additional files to be loaded on the board, as all of the modules are already included in Micropython
[17:21:04]<donblair[m]>I can quickly try to remove references to the DHT22 sensor, if that's useful? And just leave code for posting a "dummy" variable to FarmOS ...
[17:25:44]<donblair[m]>skipper_is: I just now made a version of the code that simply posts dummy variable values to FarmOS, here: https://gist.github.com/dwblair/280d1394e99e5cdd064561d5ed54bb41 -- let me know if you have any q's ... Cheerio!
[17:49:34]<donblair[m]>Just to be clear: I believe you should only require that sole file (the one in the gist) for it to work
[17:57:33]* JustTB has quit (Quit: Leaving.)
[18:15:12]* JustTB has joined #farmos