Hi
I have try to use burp proxy for know at what ip I generate the request:
but using a proxy server on 127.0.0.1:8080 and redirect the traffic on the
192.168.x.x (my-ip):3111
Using google chrome, the result is correct and I see all my record in db.
Using the application it gave me an error: Failed to connect to
/127.0.0.1:8080
I re-wrote the code and I taken out the task.
now the code is like this:
@action("produzione", method="GET")
@action("produzione/<db>/<idmac>/")
@action("produzione/<db>/<idmac>/<datafrom>/<datato>/")
def produzione(db, idmac, datafrom=None, datato=None):
object_list = []
sIstancePrd = "mssql4://{}:{}@{}/{}".format("<my_user>", "<my_pass>",
"<my_istance>", db)
dbPrd = DAL(sIstancePrd, folder=settings.DB_FOLDER, pool_size=settings.
DB_POOL_SIZE, migrate_enabled=False)
dbPrd.define_table(
'Produzione',
Field('ID','id'),
Field('DataLoggerID', type='integer'),
Field('DataLoggerIDRiga', type='integer'),
Field('Utente', type='integer'),
Field('Commessa', type='string'),
Field('Lotto', type='string'),
Field('Fase', type='integer'),
Field('Programma', type='string'),
Field('OraInizio',type='datetime',default=lambda r:datetime.datetime
.now()),
Field('OraProgrammazione',type='datetime',default=lambda r:datetime.
datetime.now()),
Field('OraAttrezzaggio',type='datetime',default=lambda r:datetime.
datetime.now()),
Field('OraPrimoPezzo',type='datetime',default=lambda r:datetime.
datetime.now()),
Field('OraProduzione',type='datetime',default=lambda r:datetime.
datetime.now()),
Field('OraFine',type='datetime',default=lambda r:datetime.datetime.
now()),
Field('NPieghe', type='integer'),
Field('Macchina', type='integer'),
Field('PezziProdotti', type='integer'))
try:
if datafrom != None and datato != None:
sSQL = "SELECT * FROM Produzione WHERE OraInizio>='{}' AND
OraFine<='{}' AND Macchina={}".format(datafrom, datato, idmac)
rows = dbPrd.executesql(sSQL)
else:
rows = dbPrd(dbPrd.Produzione.Macchina == idmac).select()
for record in rows:
d = collections.OrderedDict()
d['ID'] = record.ID
d['DataLoggerID'] = record.DataLoggerID
d['DataLoggerIDRiga'] = record.DataLoggerIDRiga
d['Utente'] = record.Utente if (record.Utente != None) else 0
d['Commessa'] = str(record.Commessa)
d['Lotto'] = str(record.Lotto)
d['Fase'] = record.Fase if (record.Fase != None) else 0
d['Programma'] = str(record.Programma)
d['OraInizio'] = str(record.OraInizio)
d['OraProgrammazione'] = str(record.OraProgrammazione)
d['OraAttrezzaggio'] = str(record.OraAttrezzaggio)
d['OraPrimoPezzo'] = str(record.OraPrimoPezzo)
d['OraProduzione'] = str(record.OraProduzione)
d['OraFine'] = str(record.OraFine)
d['NPieghe'] = record.NPieghe if (record.NPieghe != None) else 0
d['Macchina'] = record.Macchina if (record.Macchina != None)
else 0
d['PezziProdotti'] = record.PezziProdotti if (record.
PezziProdotti != None) else 0
object_list.append(d)
except Exception as inst:
if settings.LOG_ENABLE:
with open(settings.LOG_PATH, "a+") as f:
f.write("Error Type: {}, Error: {}".format(type(inst), inst
))
else:
print ("Error Type: {}, Error: {}".format(type(inst), inst))
return json.dumps(object_list)
but when I try to use getAsync() on the application it generate anyway the
error: "Unexpected end of stream"
Normaly in the application I generate an http request.
someone know why or can help me for looking some forum or something else
for resolve this issue.
Thanks
Edoardo Torrini
Il giorno giovedì 27 febbraio 2020 02:38:06 UTC+1, Dave S ha scritto:
>
>
>
> On Tuesday, February 25, 2020 at 12:52:46 AM UTC-8, Edoardo Torrini wrote:
>>
>> Hi Dave,
>> thanks for the reply, but I have notice that the code is wrong, I will
>> explain.
>> Since I need three function in task I used another one to collector and
>> after I redirect by an if statement.
>>
>
> Okay, the correction takes care of my surprise, and I re-read your other
> thread with that in mind.
>
> I am not sure why you are using a task; but that's a side issue.
>
> Do I understand the results correctly?
>
> * you have two versions, one with task and a test version without a task
> * both versions run ok with browser-initiated requests
> * the task version does not run ok from the client
>
> Does the test version run ok from the client?
>
> does the GetAsync() call generate an HTTP(S) request? Have you looked at
> the request details in either log files or with Christian's suggestion of
> burp suite and compared that to the browser request? How long does it take
> for the task to start and run?
>
> Sorry I'm not more help, I've been "watching" py4web but haven't actually
> used it, and the same for celery, so I've not dived into the request
> details or more of scheduling than the celery tutorial.
>
> Good luck!
>
> Dave
> /dps
>
>
>
>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/2b4a2707-b98b-42cb-a342-72d2f0acf6bc%40googlegroups.com.