• If you need help or want to discuss things, you now can also join us on our Discord Server!
  • A first preview of the unlimited version of SinusBot can be found in the Upcoming Changes thread. A version for Windows will follow, but we don't have a release date, yet.

Solved HTTP

Status
Not open for further replies.

Apofix

Member
Operating System: Linux
SinusBot Version: 0.9.15-b20cc30
TS3 Version: 3.0.9.14

Problem Description
When I'm using External Communication (via http), sometimes response.data does not contain all requested data
For example https://api.opendota.com/api/matches/2861043569
response.data ( http://pastebin.com/SRm2kFAJ ) does not contain whole JSON response.


Code:
==========================================================
SINUSBOT RELATED
SYSTEM INFORMATION
 - Operating System: Debian GNU/Linux 8.3 (jessie) 
 - OS x64 check: OK
 - Kernel: Linux 3.16.0-4-amd64 x86_64
 - Load Average: 0.02 0.05 0.05
 - Uptime: 192 days, 2 hours, 52 minutes, 41 seconds
 - OS Updates: 737 (updates available!)
 - OS Missing Packages: None (v1)
 - OS APT Last Update: 10.12.2016 15:49:35 CET +01:00:00
 - Bot Start Script: not found 
 - DNS resolution check: google.com -> OK
 - CPU:
    Architecture:          x86_64
    CPU(s):                1
    Thread(s) per core:    1
    Core(s) per socket:    1
    Socket(s):             1
    Model name:            Intel(R) Xeon(R) CPU E5-2650L v3 @ 1.80GHz
    CPU MHz:               1799.998
    Hypervisor vendor:     VMware
    Virtualization type:   full
 - RAM: 406.16 MB/1000.41 MB in use (40%) 
 - SWAP: 125.57 MB/1.85 GB in use (6%) 
 - DISK: 4.98 GB/11.92 GB in use (41%) 
 - Package versions:
   > libglib: 2.48.1-1

BOT INFORMATION
 - Status: running (PIDs: 30512 30511, User: root)
 - Webinterface: port locally not reachable (Port: 8087)
 - Binary: /opt/ts3soundboard/sinusbot (MD5 Hash: ca497448f617fc17a5bb579980a8572e)
 - Version: 0.9.15-b20cc30
 - TS3 Plugin: installed (md5 hash match)
   - Bot Plugin: 0b71cb8de70ec252d6f339b26c3a0e82
   - TS3 Client: 0b71cb8de70ec252d6f339b26c3a0e82
 - Config:
   - LogLevel = 10 (debug log active)
   - TS3Path = /opt/ts3soundboard/TeamSpeak3-Client-linux_amd64/ts3client_linux_amd64 (Version 3.0.19.4)
   - YoutubeDLPath = /usr/local/bin/youtube-dl (does exist, version: 2016.06.25)
 - Installed scripts: adpi_en_1.3.js; advertising.js; aloneMode.js; animatedNick.js; badchan.js; bookmark.js; covatar.js; description changer.js; dev.js; digitalclock.js; dota.js; followme.js; greetonjoin.js; idle.js; individual-welcome.js; metadata.js; nickCrashHelper.js; norecording.js; reconnect.js; rememberChannel.js; showcase.js; sound.js; UseTSAdminBOT.js; welcomeSound.js; welcometext.js; youtube; youtube.js; ZTSupport.js

OTHER INFORMATION
 - Report date: 22.12.2016 20:56:57 CET +01:00:00 (timezone: Europe/Rome)
 - TeamSpeak 3 Version: 3.0.19.4 
 - youtube-dl Version: 2016.06.25
 - DiagScript version: 0.4.6
==========================================================
 
Is this realy solved? Witch version 0.13.37 I still just get 102358 bytes of data in response.data. I set the maxsize to 1 MB and with the debug option I'll get every data in the log. Is there any event to get all data?
 

flyth

is reticulating splines
Staff member
Developer
Contributor
Is this realy solved? Witch version 0.13.37 I still just get 102358 bytes of data in response.data. I set the maxsize to 1 MB and with the debug option I'll get every data in the log. Is there any event to get all data?
Use maxSize instead of maxsize. If that doesn't help, post your example.
 
Use maxSize instead of maxsize. If that doesn't help, post your example.
Hello flyth,

I used already both cases. For the http method there is no documentation available anymore so I have to try it out ;).

But here is an example filled with data of my account.

JavaScript:
function init(sinusbot, config) {
    sinusbot.http({
        'method': 'GET',
        'url': 'https://r6db.com/api/v2/players/b45a39f0-7510-4f67-b195-68f23e6843c5',
        'maxSize': 1024 * 1024 * 1024,
        'timeout': 10000,
        debug: true,
        'headers': {
            'accept': 'application/json',
            'x-app-id': '24',
        }
    },
    function (error, response) {
        if (response.statusCode != 200) {
            engine.log(error);
            return;
        }
       
        engine.log("Returned data:\n" + response.data);
        engine.log("Data length: " + response.data.length); // should be near 102.000 bytes
       
        var result;
        try {
            result = JSON.parse(response.data);
        } catch (error) {
            engine.log(error.message);
            return;
        }
       
        engine.log(result.rank.emea);
    });
}

As you would see on the log: All data will be received on debug output but response.data has not all in it.
 

flyth

is reticulating splines
Staff member
Developer
Contributor
Ah sorry, it's actually maxLength. And it has to be <= 100MB, otherwise it'll be reset to the default, which is 100kB.
So maxLength: 1024 * 1024 * 10 should work for you.
As for the docs, you're right. I need to find some time to migrate that http call to the new engine and then it'll get documented properly.
 
Status
Not open for further replies.
Top