How to solve 'request that this server could not understand' error?scikit - random forest regressor - AttributeError: 'Thread' object has no attribute '_children'(psycopg2.OperationalError) could not connect to server: Connection refused Is the serverUpdating pip not working in ubuntu 14.04Flask gives “error 32 broken pipe” when being requested too oftencannot connect to postgres databaseTensorflow model as service gives errorDjango KeyError 'pk' POST methodHow to solve django with mysql error in insertingError in predicting from RNN Model using Flask Servergetting error while using Flask JWT, AttributeError: 'list' object has no attribute 'id' and shows 500 Internal server error

Why is the total probability theorem expressed in this way?

Interviewing with an unmentioned 9 months of sick leave taken during a job

Wordplay addition paradox

How could an animal "smell" carbon monoxide?

What happens if a company buys back all of its shares?

Optimising the Selection of MaxValue in Association

Create Array from list of indices/values

Jump back to the position I started a search

What "fuel more powerful than anything the West (had) in stock" put Laika in orbit aboard Sputnik 2?

How to create array of references?

Did 007 exist before James Bond?

Does the Intel 8085 CPU use real memory addresses?

What is the word for "event executor"?

A verb to describe specific positioning of three layers

FPGA CPUs, how to find the max speed?

How to color a tag in a math equation?

Why do space operations use "nominal" to mean "working correctly"?

Do dragons smell of lilacs?

Why are there no polls of Tom Steyer yet?

Is there an English equivalent for "Les carottes sont cuites", while keeping the vegetable reference?

Is it ethical for a company to ask its employees to move furniture on a weekend?

Why don't commercial aircraft adopt a slightly more seaplane-like design to allow safer ditching in case of emergency?

How to remove the first colon ':' from a timestamp?

Using SPID in DB Tables (instead of Table Variable)



How to solve 'request that this server could not understand' error?


scikit - random forest regressor - AttributeError: 'Thread' object has no attribute '_children'(psycopg2.OperationalError) could not connect to server: Connection refused Is the serverUpdating pip not working in ubuntu 14.04Flask gives “error 32 broken pipe” when being requested too oftencannot connect to postgres databaseTensorflow model as service gives errorDjango KeyError 'pk' POST methodHow to solve django with mysql error in insertingError in predicting from RNN Model using Flask Servergetting error while using Flask JWT, AttributeError: 'list' object has no attribute 'id' and shows 500 Internal server error






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I have built an API with Flask and keep getting an error when testing it with postman.



I only started getting this error when I added threading so that I could continue running my scraper after returning data to postman, now I'm not sure how to get past this issue



My code looks something like this:



from threading import Thread
from flask import Flask

application = Flask(__name__)

class Compute(Thread):
def __init__(self, request):
print("init")
Thread.__init__(self)
self.request = request

def run(self):
print("RUN")
command = './webscraper.py -us "user" -p "password" -url "url"'.format(**self.request.json)
output = subprocess.call(['bash','-c', command])
print("done")

@application.route('/scraper/run', methods=['POST'])
def init_scrape():
thread_a = Compute(request.__copy__())
thread_a.start()
return jsonify('Scraping this site: ': request.json["url"]), 201

if __name__ == '__main__':
application.run(host="0.0.0.0", port="8080")



My POST data is just a site url and details to login to it, looks something like this



data = {


"user":"username",
"password":"password",
"url":"www.mysite.com/"




If I make a POST request to localhost:8080/scraper/run with postman I get this error:



init
RUN
Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "api_app.py", line 19, in run
command = './portal_scrape.py -us "user" -p "password" -start start -end end -fav "favourite" -url "url"'.format(**self.request.json)
File "/home/connor/Desktop/portal_dl/venv36/lib/python3.6/site-packages/flask/wrappers.py", line 47, in json
return self.get_json()
File "/home/connor/Desktop/portal_dl/venv36/lib/python3.6/site-packages/flask/wrappers.py", line 71, in get_json
data = self._get_data_for_json(cache=cache)
File "/home/connor/Desktop/portal_dl/venv36/lib/python3.6/site-packages/flask/wrappers.py", line 50, in _get_data_for_json
return self.get_data(cache=cache)
File "/home/connor/Desktop/portal_dl/venv36/lib/python3.6/site-packages/werkzeug/wrappers.py", line 514, in get_data
rv = self.stream.read()
File "/home/connor/Desktop/portal_dl/venv36/lib/python3.6/site-packages/werkzeug/wsgi.py", line 1307, in read
return self.on_disconnect()
File "/home/connor/Desktop/portal_dl/venv36/lib/python3.6/site-packages/werkzeug/wsgi.py", line 1275, in on_disconnect
raise ClientDisconnected()
werkzeug.exceptions.ClientDisconnected: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.




I am sending the same POST request I had used when it was working without threading










share|improve this question



















  • 1





    check the logs, put prints inside our function and let us know what happens

    – E.Serra
    Mar 26 at 9:14






  • 1





    It would also be helpful to include details of the request you are asking postman to send.

    – holdenweb
    Mar 26 at 9:17











  • updated my post with both suggestions

    – user7496277
    Mar 26 at 9:22

















1















I have built an API with Flask and keep getting an error when testing it with postman.



I only started getting this error when I added threading so that I could continue running my scraper after returning data to postman, now I'm not sure how to get past this issue



My code looks something like this:



from threading import Thread
from flask import Flask

application = Flask(__name__)

class Compute(Thread):
def __init__(self, request):
print("init")
Thread.__init__(self)
self.request = request

def run(self):
print("RUN")
command = './webscraper.py -us "user" -p "password" -url "url"'.format(**self.request.json)
output = subprocess.call(['bash','-c', command])
print("done")

@application.route('/scraper/run', methods=['POST'])
def init_scrape():
thread_a = Compute(request.__copy__())
thread_a.start()
return jsonify('Scraping this site: ': request.json["url"]), 201

if __name__ == '__main__':
application.run(host="0.0.0.0", port="8080")



My POST data is just a site url and details to login to it, looks something like this



data = {


"user":"username",
"password":"password",
"url":"www.mysite.com/"




If I make a POST request to localhost:8080/scraper/run with postman I get this error:



init
RUN
Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "api_app.py", line 19, in run
command = './portal_scrape.py -us "user" -p "password" -start start -end end -fav "favourite" -url "url"'.format(**self.request.json)
File "/home/connor/Desktop/portal_dl/venv36/lib/python3.6/site-packages/flask/wrappers.py", line 47, in json
return self.get_json()
File "/home/connor/Desktop/portal_dl/venv36/lib/python3.6/site-packages/flask/wrappers.py", line 71, in get_json
data = self._get_data_for_json(cache=cache)
File "/home/connor/Desktop/portal_dl/venv36/lib/python3.6/site-packages/flask/wrappers.py", line 50, in _get_data_for_json
return self.get_data(cache=cache)
File "/home/connor/Desktop/portal_dl/venv36/lib/python3.6/site-packages/werkzeug/wrappers.py", line 514, in get_data
rv = self.stream.read()
File "/home/connor/Desktop/portal_dl/venv36/lib/python3.6/site-packages/werkzeug/wsgi.py", line 1307, in read
return self.on_disconnect()
File "/home/connor/Desktop/portal_dl/venv36/lib/python3.6/site-packages/werkzeug/wsgi.py", line 1275, in on_disconnect
raise ClientDisconnected()
werkzeug.exceptions.ClientDisconnected: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.




I am sending the same POST request I had used when it was working without threading










share|improve this question



















  • 1





    check the logs, put prints inside our function and let us know what happens

    – E.Serra
    Mar 26 at 9:14






  • 1





    It would also be helpful to include details of the request you are asking postman to send.

    – holdenweb
    Mar 26 at 9:17











  • updated my post with both suggestions

    – user7496277
    Mar 26 at 9:22













1












1








1








I have built an API with Flask and keep getting an error when testing it with postman.



I only started getting this error when I added threading so that I could continue running my scraper after returning data to postman, now I'm not sure how to get past this issue



My code looks something like this:



from threading import Thread
from flask import Flask

application = Flask(__name__)

class Compute(Thread):
def __init__(self, request):
print("init")
Thread.__init__(self)
self.request = request

def run(self):
print("RUN")
command = './webscraper.py -us "user" -p "password" -url "url"'.format(**self.request.json)
output = subprocess.call(['bash','-c', command])
print("done")

@application.route('/scraper/run', methods=['POST'])
def init_scrape():
thread_a = Compute(request.__copy__())
thread_a.start()
return jsonify('Scraping this site: ': request.json["url"]), 201

if __name__ == '__main__':
application.run(host="0.0.0.0", port="8080")



My POST data is just a site url and details to login to it, looks something like this



data = {


"user":"username",
"password":"password",
"url":"www.mysite.com/"




If I make a POST request to localhost:8080/scraper/run with postman I get this error:



init
RUN
Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "api_app.py", line 19, in run
command = './portal_scrape.py -us "user" -p "password" -start start -end end -fav "favourite" -url "url"'.format(**self.request.json)
File "/home/connor/Desktop/portal_dl/venv36/lib/python3.6/site-packages/flask/wrappers.py", line 47, in json
return self.get_json()
File "/home/connor/Desktop/portal_dl/venv36/lib/python3.6/site-packages/flask/wrappers.py", line 71, in get_json
data = self._get_data_for_json(cache=cache)
File "/home/connor/Desktop/portal_dl/venv36/lib/python3.6/site-packages/flask/wrappers.py", line 50, in _get_data_for_json
return self.get_data(cache=cache)
File "/home/connor/Desktop/portal_dl/venv36/lib/python3.6/site-packages/werkzeug/wrappers.py", line 514, in get_data
rv = self.stream.read()
File "/home/connor/Desktop/portal_dl/venv36/lib/python3.6/site-packages/werkzeug/wsgi.py", line 1307, in read
return self.on_disconnect()
File "/home/connor/Desktop/portal_dl/venv36/lib/python3.6/site-packages/werkzeug/wsgi.py", line 1275, in on_disconnect
raise ClientDisconnected()
werkzeug.exceptions.ClientDisconnected: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.




I am sending the same POST request I had used when it was working without threading










share|improve this question
















I have built an API with Flask and keep getting an error when testing it with postman.



I only started getting this error when I added threading so that I could continue running my scraper after returning data to postman, now I'm not sure how to get past this issue



My code looks something like this:



from threading import Thread
from flask import Flask

application = Flask(__name__)

class Compute(Thread):
def __init__(self, request):
print("init")
Thread.__init__(self)
self.request = request

def run(self):
print("RUN")
command = './webscraper.py -us "user" -p "password" -url "url"'.format(**self.request.json)
output = subprocess.call(['bash','-c', command])
print("done")

@application.route('/scraper/run', methods=['POST'])
def init_scrape():
thread_a = Compute(request.__copy__())
thread_a.start()
return jsonify('Scraping this site: ': request.json["url"]), 201

if __name__ == '__main__':
application.run(host="0.0.0.0", port="8080")



My POST data is just a site url and details to login to it, looks something like this



data = {


"user":"username",
"password":"password",
"url":"www.mysite.com/"




If I make a POST request to localhost:8080/scraper/run with postman I get this error:



init
RUN
Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "api_app.py", line 19, in run
command = './portal_scrape.py -us "user" -p "password" -start start -end end -fav "favourite" -url "url"'.format(**self.request.json)
File "/home/connor/Desktop/portal_dl/venv36/lib/python3.6/site-packages/flask/wrappers.py", line 47, in json
return self.get_json()
File "/home/connor/Desktop/portal_dl/venv36/lib/python3.6/site-packages/flask/wrappers.py", line 71, in get_json
data = self._get_data_for_json(cache=cache)
File "/home/connor/Desktop/portal_dl/venv36/lib/python3.6/site-packages/flask/wrappers.py", line 50, in _get_data_for_json
return self.get_data(cache=cache)
File "/home/connor/Desktop/portal_dl/venv36/lib/python3.6/site-packages/werkzeug/wrappers.py", line 514, in get_data
rv = self.stream.read()
File "/home/connor/Desktop/portal_dl/venv36/lib/python3.6/site-packages/werkzeug/wsgi.py", line 1307, in read
return self.on_disconnect()
File "/home/connor/Desktop/portal_dl/venv36/lib/python3.6/site-packages/werkzeug/wsgi.py", line 1275, in on_disconnect
raise ClientDisconnected()
werkzeug.exceptions.ClientDisconnected: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.




I am sending the same POST request I had used when it was working without threading







python multithreading flask






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 9:19

























asked Mar 26 at 9:12







user7496277














  • 1





    check the logs, put prints inside our function and let us know what happens

    – E.Serra
    Mar 26 at 9:14






  • 1





    It would also be helpful to include details of the request you are asking postman to send.

    – holdenweb
    Mar 26 at 9:17











  • updated my post with both suggestions

    – user7496277
    Mar 26 at 9:22












  • 1





    check the logs, put prints inside our function and let us know what happens

    – E.Serra
    Mar 26 at 9:14






  • 1





    It would also be helpful to include details of the request you are asking postman to send.

    – holdenweb
    Mar 26 at 9:17











  • updated my post with both suggestions

    – user7496277
    Mar 26 at 9:22







1




1





check the logs, put prints inside our function and let us know what happens

– E.Serra
Mar 26 at 9:14





check the logs, put prints inside our function and let us know what happens

– E.Serra
Mar 26 at 9:14




1




1





It would also be helpful to include details of the request you are asking postman to send.

– holdenweb
Mar 26 at 9:17





It would also be helpful to include details of the request you are asking postman to send.

– holdenweb
Mar 26 at 9:17













updated my post with both suggestions

– user7496277
Mar 26 at 9:22





updated my post with both suggestions

– user7496277
Mar 26 at 9:22












0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55353394%2fhow-to-solve-request-that-this-server-could-not-understand-error%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown
























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55353394%2fhow-to-solve-request-that-this-server-could-not-understand-error%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현