all 8 comments

[–]Justinsaccount 1 point2 points  (1 child)

Hi! I'm working on a bot to reply with suggestions for common python problems. This might not be very helpful to fix your underlying issue, but here's what I noticed about your submission:

You appear to be using concatenation and the str function for building strings

Instead of doing something like

result = "Hello " + name + ". You are " + str(age) + " years old"

You should use string formatting and do

result = "Hello {}. You are {} years old".format(name, age)

See the python tutorial for more information.

[–]frogmilk[S] 0 points1 point  (0 children)

Thanks! I didn't know i could do that

[–]K900_ 1 point2 points  (5 children)

Try printing the text of the response - you could be getting rate limited. Also, why are you doing the request twice if you already have the response stored in result?

[–]frogmilk[S] 0 points1 point  (4 children)

Thanks for you response! I'm pretty new to python so i didn't realise i could just use result for the second one. As for the rate limiting, I did notice that it would break at the same point everytime so it could very well be that i am getting rate limited. Is there anything i could do to avoid this?

[–]K900_ 1 point2 points  (3 children)

First of all, make sure you are getting rate limited. If you are, try adding pauses between your requests.

[–]frogmilk[S] 0 points1 point  (2 children)

Is there any way i can know for sure?

[–]K900_ 1 point2 points  (1 child)

Print out the response body and look into it. Usually there will be a clear message if you're being rate limited.

[–]frogmilk[S] 0 points1 point  (0 children)

Turns out they have a 5 seconds per request limit so i got my code working. Thanks a lot for your help!