Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requests reached the daily limit #365

Open
corasaniti opened this issue Nov 19, 2024 · 3 comments
Open

Requests reached the daily limit #365

corasaniti opened this issue Nov 19, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@corasaniti
Copy link

corasaniti commented Nov 19, 2024

Analysis

I get the following error for every command?
Anyone else having the same problem?

{"statusCode":190,"body":{},"message":"Requests reached the daily limit"}

Expected Behavior

Being able to invoke API1.1 via Python

Steps To Reproduce

Invoke API1.1 via Python or curl command

Logs

`{"statusCode":190,"body":{},"message":"Requests reached the daily limit"}`

Configuration

Switch Bot

Environment

  • OS: Raspian
  • Software: Bash Linux and Python

Additional Context

API1.1 error

@hsakoh
Copy link

hsakoh commented Nov 19, 2024

The amount of API calls per day is limited to **10000** times. Going over that limit will return "Unauthorized."

@corasaniti
Copy link
Author

corasaniti commented Nov 20, 2024

@hsakoh
Thanks but I'm using this authentication method with Python3, using tocken and secret..
It always worked but yesterday it stopped working

import json
import time
import hashlib
import hmac
import base64
import uuid

# Declare empty header dictionary
apiHeader = {}
# open token
token = '' # copy and paste from the SwitchBot app V6.14 or later
# secret key
secret = '' # copy and paste from the SwitchBot app V6.14 or later
nonce = uuid.uuid4()
t = int(round(time.time() * 1000))
string_to_sign = '{}{}{}'.format(token, t, nonce)

string_to_sign = bytes(string_to_sign, 'utf-8')
secret = bytes(secret, 'utf-8')

sign = base64.b64encode(hmac.new(secret, msg=string_to_sign, digestmod=hashlib.sha256).digest())
print ('Authorization: {}'.format(token))
print ('t: {}'.format(t))
print ('sign: {}'.format(str(sign, 'utf-8')))
print ('nonce: {}'.format(nonce))

#Build api header JSON
apiHeader['Authorization']=token
apiHeader['Content-Type']='application/json'
apiHeader['charset']='utf8'
apiHeader['t']=str(t)
apiHeader['sign']=str(sign, 'utf-8')
apiHeader['nonce']=str(nonce)

I waited until 00.00.00 hoping that the counter would restart from zero, but instead it is 06 in the morning and it still does not work. Thanks again

@corasaniti
Copy link
Author

Update
Since this morning API1.0 and API1.1 are working correctly
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants