Custom QR Code

FREEMIUM
By unitag | Updated 4 days ago | Tools
Popularity

0.3 / 10

Latency

65,123ms

Service Level

0%

Health Check

N/A

Back to All Discussions

Bought Subscription But Still Have Daily Limit

Rapid account: Joannafinkelstein
joannafinkelstein
8 years ago

Mashape Support sent me to you. I bought the mega subscription to the NLTK API, but it still has the daily limit of 5,000 for me. I have a python script on my desktop that makes curl requests to the API. After I make 5,000 requests (successfully), it stops giving replies (labels) to my requests. It says Throttled. Can you fix this?

Rapid account: Japerk
japerk Commented 8 years ago

Yes, the X-Mashape-Key should be the same as what’s show in the code examples.

What you should do is wrap each call in a try-except block. Here’s a tutorial: https://wiki.python.org/moin/HandlingExceptions
If the call fails, you could maybe try it again using something like this: https://pypi.python.org/pypi/retry
When you’re doing lots API calls, things can sometimes fail for random reasons, so it’s a good idea to try to handle those using a retry strategy.

You can tell when a request succeeds if the response.code is 200.

Rapid account: Joannafinkelstein
joannafinkelstein Commented 8 years ago

How do I know what my “X-Mashape-Key” is? Is it the same as in the code example for Python? Is there some way to check that the request received a response properly so that it doesn’t crash if for some reason one request doesn’t work? Also, after making some number (between 1 and 1000) successful requests, I got an error that I don’t understand. This is what Terminal says:
Traceback (most recent call last):
File “parserCSV.py”, line 157, in <module>
“text”: comment
File “/Library/Python/2.7/site-packages/unirest/init.py”, line 144, in post
return __dorequest(“POST”, url, get_parameters(kwargs), kwargs.get(HEADERS_KEY, {}), kwargs.get(AUTH_KEY, None), kwargs.get(CALLBACK_KEY, None))
File “/Library/Python/2.7/site-packages/unirest/init.py”, line 174, in __dorequest
return __request(method, url, params, headers, auth)
File “/Library/Python/2.7/site-packages/unirest/init.py”, line 97, in __request
response = urllib2.urlopen(req, timeout=_timeout)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”, line 154, in urlopen
return opener.open(url, data, timeout)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”, line 431, in open
response = self._open(req, data)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”, line 449, in _open
’_open’, req)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”, line 409, in _call_chain
result = func(*args)
File “/Library/Python/2.7/site-packages/poster/streaminghttp.py”, line 170, in https_open
return self.do_open(StreamingHTTPSConnection, req)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”, line 1197, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error (’_ssl.c:574: The handshake operation timed out’,)>

Rapid account: Japerk
japerk Commented 8 years ago

Take a look at the docs at https://market.mashape.com/japerk/text-processing. On the right side, there are client examples, and you can select Python to see code examples using the Unirest client. More details & how to install Unirest python: http://unirest.io/python.html

Rapid account: Joannafinkelstein
joannafinkelstein Commented 8 years ago

Yes, I’m still using API for text-processing.com how do I go through the Mashape API, using their client library to make requests?

Rapid account: Japerk
japerk Commented 8 years ago

Are you making the requests thru the Mashape API, or are you still using API for text-processing.com?
You need to go thru the Mashape API, using their client library to make requests, in order to get past the normal limits.

Join in the discussion - add comment below:

Login / Signup to post new comments