Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not correctly reporting nonce errors

See original GitHub issue

I noticed this today when doing a doc update for pythonanywhere. I used an old API key and was getting

HTTP Error 422: Requesting returnOpenLoanOffers

After messing about with pdb I found it was actually

'{"error":"Nonce must be greater than 149457735191782915. You provided 1494578980835."}'

So these aren’t showing the full issue:

(Pdb) ex
(Pdb) str(ex)
'HTTP Error 422: '
(Pdb) ex.message
'HTTP Error 422:  Requesting returnOpenLoanOffers'

I’ll have a closer look, but I think we might need to do a bit more handling on exceptions when we catch them.

It’s pretty easy to replicate, just set your req['nonce'] = int(time.time() * 1000) to req['nonce'] = int(time.time() * 10) or something.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

tisdallcommented, Jun 2, 2017

… making a PR now.

tisdallcommented, Jun 2, 2017

@rnevet - It’s only handled there if the response is HTTP 200. The issue is if the response has an error code it’s returned as a urllib2.HTTPError. However, according to the docs, that exception can be handled in the same way as the return value from urlopen so you can read the body contents (if any). I put it in a try-except block because it’s possible to get an HTTP error code with no usable body.

As laxdog said, you can just change the nonce calculation to force it to return an error and you get back the message I quoted above.

The API docs are pretty lacking because it doesn’t state anywhere when you get HTTP error codes and when you don’t.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What a Nonce Error Is & How to Fix It - HubSpot Blog
A nonce error is caused when a user makes a request without having the correct nonce generated by WordPress and given to the...
Read more >
Nonce error at checkout with Easy Digital Downloads
Hello, I'm running into an issue that I cannot seem to properly resolve. I have the plugin Easy Digital Downloads installed, and when...
Read more >
UsingWW: The "duplicate nonce" error is back - WeBWorK
I click on a problem, answer one of the questions, click grade, and the grade is reported to be successfully sent back to...
Read more >
Avoid reporting "Invalid Nonce" when removing a transaction if ...
I'm deploying and executing a series of transaction to a contract on a fresh chain, and it all works well except there are...
Read more >
Server: Nonce not found error when modifying schedules
Solved: Hi all I hope someone might be able to help with this, we have recently upgraded our server version to 2020.2 and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found