Forums

Awkard problem about results an api

I am using a flask py code as my rest api, it gets results from different api's and mapping them as json. I did some manual changings to correct some results but after I undone them or write a new code it works well just it keeps showing some information which is not belong to my code or current api results. When I tried same code in my local machine it's working without any problem but here it keeps turning one or two irrevelant result. Is there any cache for flask which I didn't know?

For explanation: Relevant part is that;

final_url = omdb_base_url + '&t=' + moviestr + '&plot=full'
    print(final_url)
    requestformovie = requests.get( final_url )
    dataomdb = requestformovie.json()
    movie_id = dataomdb['imdbID']
    print(movie_id)
    tmdb_url_final = tmdb_url + str(movie_id).replace("tt1727388", "tt8544498") + tmdb_apkey
    print(tmdb_url_final)

Server log shows:

2020-03-25 16:54:49 Bloodshot

2020-03-25 16:54:49 http://www.omdbapi.com/?apikey=ff371088&t=Bloodshot&plot=full

2020-03-25 16:54:50 tt2622988

2020-03-25 16:54:50 https://api.themoviedb.org/3/movie/tt2622988?api_key=1b8cfaea32775f684a7baff93bb1a3fc&append_to_response=credits&language=en

this IMDB number(tt2622988) one of I used replace for irreevelant IMDB number, I changed my source so there is no request for it in anywhere right now, it used to replace this number tt3821198 with it, but there is nothing reference to this or other number in api or my code but it still keeps coming, when you check first url which app get the IMDB number from that json file there is no anything relevant to this number.and I remove all replace actions from my code, I think there must be some caching somewhere but I can't figured out..

Have you reloaded your web app since making the change?

yes I did, also I was run in virtualenv and I make another py file outside it and set my web app according to new files but results are same.. Also I added below lines to my code in case flask or python hold some cache..

at beginning;

app = Flask(__name__)
app.config["CACHE_TYPE"] = "null"
@app.route('/query', methods=['GET', 'POST'])

and as last line;

movie_id = None

hmm, I would try to run the same code from a PythonAnywhere console and see what the result is. I feel this may be a case of for example your webapp running code from say path x, and you changing a different file at say path y.