Jump to content
McKay Development

Recommended Posts

Posted

Hi,

I wrote my own library that interacts with Steam servers.

My version of getConfirmations works fine with one bot. It runs periodically every 10 seconds with no issues.

Today, I hooked it up with six bots running simultaneously. This is where errors 429 (too many requests) start happening.

Seems like steamcommunity.com/mobileconf/conf has a rate limit: 6 requests per minute from the same IP.

Am I right?

Posted

Here's a little demo just in case anybody else curious about rate limits.

'use strict';

const
	SteamCommunity = require('steamcommunity'),
	SteamTotp      = require('steam-totp'),
	COMMUNITY      = new SteamCommunity();

const
	USERNAME        = '...',
	PASSWORD        = '...',
	SHARED_SECRET   = '...',
	IDENTITY_SECRET = '...',
	CODE            = SteamTotp.getAuthCode(SHARED_SECRET),
	INTERVAL        = 5000;

COMMUNITY.login({
	accountName:   USERNAME,
	password:      PASSWORD,
	twoFactorCode: CODE
}, function(err, sessionID, cookies, steamguard, oAuthToken){

	if (err) {
		console.log('login ERROR:', err);
		return;
	}

	COMMUNITY.setCookies(cookies);

	let n = 0;
	const onInterval = function () {
		n += 1;

		const time = Math.round(Date.now() / 1000);
		const key  = SteamTotp.getConfirmationKey(IDENTITY_SECRET, time, 'conf');

		COMMUNITY.getConfirmations(time, key, function (err, confirmations) {
			if (err) {
				console.log(`${n}: getConfirmations ERROR:`, err);
				return;
			}
			console.log(`${n}: getConfirmations OK`);
		});
	};
	setInterval(onInterval, INTERVAL);
	
});

INTERVAL === 10000

1: getConfirmations OK
2: getConfirmations OK
3: getConfirmations OK
4: getConfirmations OK
5: getConfirmations OK
6: getConfirmations OK
7: getConfirmations OK
8: getConfirmations OK
9: getConfirmations OK

INTERVAL === 5000

1: getConfirmations OK
2: getConfirmations OK
3: getConfirmations OK
4: getConfirmations OK
5: getConfirmations OK
6: getConfirmations OK
7: getConfirmations ERROR: { [Error: HTTP error 429] code: 429 }
8: getConfirmations ERROR: { [Error: HTTP error 429] code: 429 }
9: getConfirmations ERROR: { [Error: HTTP error 429] code: 429 }

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...