barbosagabriel / cei-api Goto Github PK
View Code? Open in Web Editor NEW💸 API to collect data from Canal Eletrônico do Investidor (CEI)
License: MIT License
💸 API to collect data from Canal Eletrônico do Investidor (CEI)
License: MIT License
I deployed the scritp in the Google Cloud AppEngine as you mentioned that you also did, but I'm having problems running it in the Browser or Insomnia.
The / token function works perfectly.
When I try to perform the functions:
/wallet
/transactions
/dividends
When I run on my machine locally it works perfectly.
But in the browser I get this message:
Error: Server Error
The server encountered an error and could not complete your request.
Please try again in 30 seconds.
And I get the following error in the App Engine logs:
I 2020-08-05T20:33:01.888646Z GET 200 259 B 5,8 s Chrome 84 / GET 200 259 B 5,8 s Chrome 84 5f2b177d00ff0d8f461f573e960001697e6170692d353030393038373230363537343335313930362d3636363731390001323032303038303574313731383037000100
W 2020-08-05T20:33:11.340270Z GET 500 0 B 9,2 s Chrome 84 /wallet GET 500 0 B 9,2 s Chrome 84 5f2b178700ff05312ef63d0b720001697e6170692d353030393038373230363537343335313930362d3636363731390001323032303038303574313731383037000100
A 2020-08-05T20:33:11.394451Z Searching wallet - Current date
A 2020-08-05T20:33:15.879413Z Logging at CEI...
A 2020-08-05T20:33:17.379446Z Error: Error: Protocol error (Target.createTarget): Target closed.
A 2020-08-05T20:33:17.379467Z at /workspace/node_modules/cei-crawler/node_modules/puppeteer/lib/Connection.js:74:56
A 2020-08-05T20:33:17.379477Z at new Promise ()
A 2020-08-05T20:33:17.379487Z at Connection.send (/workspace/node_modules/cei-crawler/node_modules/puppeteer/lib/Connection.js:73:12)
A 2020-08-05T20:33:17.379496Z at Browser._createPageInContext (/workspace/node_modules/cei-crawler/node_modules/puppeteer/lib/Browser.js:174:47)
A 2020-08-05T20:33:17.379505Z at BrowserContext.newPage (/workspace/node_modules/cei-crawler/node_modules/puppeteer/lib/Browser.js:367:26)
A 2020-08-05T20:33:17.379512Z at Browser.newPage (/workspace/node_modules/cei-crawler/node_modules/puppeteer/lib/Browser.js:166:33)
A 2020-08-05T20:33:17.379520Z at Browser. (/workspace/node_modules/cei-crawler/node_modules/puppeteer/lib/helper.js:112:23)
A 2020-08-05T20:33:17.379528Z at CeiCrawler._callee2$ (/workspace/node_modules/cei-crawler/app.js:547:38)
A 2020-08-05T20:33:17.379536Z at tryCatch (/workspace/node_modules/regenerator-runtime/runtime.js:63:40)
A 2020-08-05T20:33:17.379554Z at Generator.invoke [as _invoke] (/workspace/node_modules/regenerator-runtime/runtime.js:293:22)
A 2020-08-05T20:33:17.379565Z -- ASYNC --
A 2020-08-05T20:33:17.379573Z at Browser. (/workspace/node_modules/cei-crawler/node_modules/puppeteer/lib/helper.js:111:15)
A 2020-08-05T20:33:17.379580Z at CeiCrawler._callee2$ (/workspace/node_modules/cei-crawler/app.js:547:38)
A 2020-08-05T20:33:17.379589Z at tryCatch (/workspace/node_modules/regenerator-runtime/runtime.js:63:40)
A 2020-08-05T20:33:17.379605Z at Generator.invoke [as _invoke] (/workspace/node_modules/regenerator-runtime/runtime.js:293:22)
A 2020-08-05T20:33:17.379615Z at Generator.next (/workspace/node_modules/regenerator-runtime/runtime.js:118:21)
A 2020-08-05T20:33:17.379627Z at asyncGeneratorStep (/workspace/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
A 2020-08-05T20:33:17.379641Z at _next (/workspace/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
A 2020-08-05T20:33:17.379652Z at processTicksAndRejections (internal/process/task_queues.js:97:5)
Please help-me, thankyou.
Estou tendo problema na hora de verificar o Token, estou com o serviço da API hospedado no GCloud AppEngine.
Utilizando esse caminho da api, agora está dando problema, ele não consegue mais utilizar o token gerado aqui.
Startei outro serviço na minha máquina local e mandei gerar o token com o mesmo login e senha, e gerou um token diferente do que possuí na API do AppEngine.
Como eu faço pra fazer esse tratamento e atualizar o Token que está salvo no SQLite? Aparentemente o processo de gerar token não gera sempre o mesmo token para o usuário e senha.
Vou tentar mandar ele gerar e gravar um token quando ocorrer esse tipo de falha.
Qualquer avanço relato aqui.
A princípio o erro que consegui localizar é o seguinte:
(node:14592) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'username' of null
at G:\CriarAPPS\Fundamentos\APIs\CEIAPPI\public\src\controllers\CEIController.ts:87:15
at step (G:\CriarAPPS\Fundamentos\APIs\CEIAPPI\public\src\controllers\CEIController.ts:33:23)
at Object.next (G:\CriarAPPS\Fundamentos\APIs\CEIAPPI\public\src\controllers\CEIController.ts:14:53)
at fulfilled (G:\CriarAPPS\Fundamentos\APIs\CEIAPPI\public\src\controllers\CEIController.ts:5:58)
(Usenode --trace-warnings ...
to show where the warning was created)
(node:14592) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:14592) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:14592) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
A possible solution would be implementing a WebSocket that notifies when the web crawler process finishes and respond with the data.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.