These are chat archives for esp8266/Arduino

9th
Jan 2019
mega-hz
@mega-hz
Jan 09 10:06
# hello, it is a bit offtopic, but is there someone who can help me converting a curl call into a python code please?
tobozo
@tobozo
Jan 09 10:19

hello, let me google that for you

mega-hz
@mega-hz
Jan 09 15:19
thanx, but i cant use request library, this converter also deletes some lines... it is a mini-linux, motioneye-os, no librarys can be installed.
python should only open curl with my datas...
tobozo
@tobozo
Jan 09 15:49
oh you meant converting to micropython ?
mega-hz
@mega-hz
Jan 09 15:50
maybe, dont know wich python there is
i also tried to make the file executable but zjat wont work
that
is it possible to make a file executable for curl ? If so, has to be something special in the file head?
tobozo
@tobozo
Jan 09 15:53
I don't know that, how often do you need to convert a curl request into python code ?
mega-hz
@mega-hz
Jan 09 15:54
only once, or a executable curl file
tobozo
@tobozo
Jan 09 15:55
ok lost myself in the motioneye documentation before figuring out I should look at motioneye-OS :D
mega-hz
@mega-hz
Jan 09 15:56
yep, there are many differences..
mega-hz
@mega-hz
Jan 09 15:57
i have also tried to type the whole curl command into the option of motioneyes-os, but it wont work. directly in the cli it works
tobozo
@tobozo
Jan 09 15:58
the first answers hints at making your own python script based on import requests
mega-hz
@mega-hz
Jan 09 15:58
import requests doesnt exist on motioneyeos and it cannot be installed :-(
i only can call a webhook or open a command.
tobozo
@tobozo
Jan 09 16:00
can you import py_compile ?
mega-hz
@mega-hz
Jan 09 16:01
have to try...
tobozo
@tobozo
Jan 09 16:02
using import pycurl is worth a try too
mega-hz
@mega-hz
Jan 09 16:03
both are working!
forget about py_compile, you can go directly with pycurl
it's more syntax-friendly
mega-hz
@mega-hz
Jan 09 16:05
the curl code looks like this:
curl 'https://api.twilio.com/2010-04-01/Accounts/AC345390e171a30a56527a35f81349$
--data-urlencode 'To=whatsapp:+4977777777' \
--data-urlencode 'From=whatsapp:+141777777777' \
--data-urlencode 'Body=KAMERA Schuppen Bewegung!!!' \
-u AC345390e171xxxxxxxxxx5f8134915cb:884a895eb13xxxxxxxfc3210ea39a660
mega-hz
@mega-hz
Jan 09 16:11
should this all be in one line like in the sample?
tobozo
@tobozo
Jan 09 16:34
if you put all in one line, remove the ending \
maybe read the pycurl doc to find out how to send multiple data-urlencode values
mega-hz
@mega-hz
Jan 09 16:47
i get a syntax error
c.setopt(c.WRITEFUNCTION, '--data-urlencode 'To=whatsapp:+4977777777' ')
tobozo
@tobozo
Jan 09 16:51
misplaced quotes, missing comma
also c.WRITEFUNCTION should be bound to a python function that actually writes
mega-hz
@mega-hz
Jan 09 16:55
could you please help me getting this code running please? i am not so good in python..
the "-u" means user, so it's probably using some kind of auth (basic auth?)
I don't know python either, and I didn't know what the "-u" was so I looked it up
gotta go, good luck with your conversion, just keep on trying, python is easy and with trial/error you'll eventually get it working
mega-hz
@mega-hz
Jan 09 17:00
yes, -u is auth... ok, thanks
mega-hz
@mega-hz
Jan 09 17:21
sorry for this offtopics folks...
Clemens Kirchgatterer
@everslick
Jan 09 18:17
i sometimes get reboots with wdt reset under !normal! operation, for example heavy usage of the webserver. that is not really helpful. can i prolong the WD timeout?
Develo
@devyte
Jan 09 18:40
@everslick it is possible to extend the sw wdt, but it's not recommended. What are you serving? you may need to add calls to yield() in your callbacks. I suggest doing a timing analysis, i.e.: measure how long your callbacks take.
Clemens Kirchgatterer
@everslick
Jan 09 18:52
i suspect, that it is actually malloc() that takes so long
Shelby Merrick
@forkineye
Jan 09 18:53
Are the different lwip options documented anywhere?
Clemens Kirchgatterer
@everslick
Jan 09 18:53
because the pages are always the same but it gest worse when the heap is fragmented
there was a project under way to refactor the webserver, wasn't there?
with the goal to make it less memory hungry
Develo
@devyte
Jan 09 19:08
@everslick there was a proposal, but it hasn't been tested
@forkineye what do you want to know?
Shelby Merrick
@forkineye
Jan 09 19:27
@devyte I was mainly curious as to what the differences were for the high bandwidth options vs low memory and what exactly "no features" means. I assume the bandwidth one may have to do with buffer sizing?
Develo
@devyte
Jan 09 20:21
buffer size
faster has bigger buffer so uses more heap
mem uses less mem due to smaller buffer, but is hence slower
Shelby Merrick
@forkineye
Jan 09 20:25
What about the "no features" options?
Develo
@devyte
Jan 09 20:31
ip fragmentation and reassembly
that's the repo for our lwip
Shelby Merrick
@forkineye
Jan 09 20:34
ah, thanks!
david gauchard
@d-a-v
Jan 09 21:08
and Selective-ACK