question-mark
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.

[BUG] - The API returns consistently 404 after 335 consecutive calls are made

See original GitHub issue

When running the API code on an AWS ec2 instance (t3.xlarge) the API consistently returns 404 for the calls (api.getUser() method) and only works when I restart the app and start calling it again. The API is running on a simple flask app that is serving it on port 8080 of the server.

The buggy code

The code I use to call the deployed API

import requests
url = "HTTP://SERVERURL//userdetail?username=bcthemc"

payload = {}
headers= {}

limit = 10000

for i in range(0, 10000):
    response = requests.request("GET", url, headers=headers, data = payload)
    print(i, response.text.encode('utf8'))

The /userdetail API call in the flask app on the ubuntu server

from flask import Flask, request
from TikTokApi import TikTokApi
app = Flask(__name__)
api = TikTokApi()
proxy = '0.0.0.0:3128'
#proxy = None

@app.route('/userdetail')
def get_user_detail():
    try:
        user_data = api.getUser(request.args.get("username"), proxy=proxy)
        return user_data, 200
    except:
        return user_data, 404

Expected behavior

I expect the API to keep returning the responses as I am using proxy rotation as well and there are no restrictions on this data from Tiktok so I don’t understand why this behavior is happening.

Error Trace (if any)

The first 334 calls yield successful results but after the 334th call, all calls return the error in the second picture.

Calls 1 to 334 work fine but after that, all of them have this error: image

This is error in detail:

image

I had to return the user_data variable and I know it will throw an error normally but I did that to capture the actual error 😃

Desktop (please complete the following information):

  • OS: Ubuntu
  • TikTokApi Version [e.g. 3.3.1] - 3.4.6

Additional context

The ec2 instance I am using is not the limiting problem as I have tried on a t2.micro, t2.medium & t3.xlarge and all exhibit the same problem and return a 404 after 334 calls are made. I have to restart the flask app and then start calling again which is not feasible in a production environment.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
duplicate-issues[bot]commented, Sep 1, 2020

Hey @hemswayy,

We did a quick check and this issue looks very darn similar to

  • #244 - Add executablePath parameter to constructor to specify executablePath for pyppeteer launch
  • #243 - [FEATURE_REQUEST] - Be able to log in an get the cookie.
  • #242 - Add Paging for hashtags

This could be a coincidence, but if any of these issues solves your problem then I did a good job 😄

If not, the maintainers will get to this issue shortly.

Cheers, Your Friendly Neighborhood ProBot

3reactions
issue-label-bot[bot]commented, Sep 1, 2020

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.89. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

All ASP.NET Web API controllers return 404 - Stack Overflow
Just curious, in MVC5, the readme states after first creating an API controller to add in GlobalConfiguration.Configure(WebApiConfig.Register); on Global.asax.
Read more >
The REST API encountered an unexpected result = 404 Not ...
After update to WP 5.8 I went to a page to edit it. I clicked “view” and received error: “Not Found. The requested...
Read more >
Should APIs use 404 as an error code? - Medium
If our API return the exact same 404 error code for both use cases, a developer may not realize that they've made a...
Read more >
OBM Tools Web server gives 404 error first run script call and ...
The issue is timing; the create request is made on GW1 and the status request is made on GW2 because of the load...
Read more >
Azure API management gives 404 error - Microsoft Q&A
Your APIM URL is incorrect where the path was not resolved correctly, and it returns 404 error. I will suggest to you to...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found