Spicy Meatball
Spicy Meatball

Reputation: 164

Python Requests POST to PHP

Thank you for taking the time to answer my question.

I'm having trouble sending a post request to a web form, GO Term, that asks for two GO (gene ontology) terms. From what I can see, this form posts to another php file, GO Compare, which sends back the numeric similarity of these two terms via http.

Here is what I've tried so far:

url = 'http://bioinformatics.clemson.edu/G-SESAME/Program/GOCompareTwo1.php'
GOterms = {'GOTerm1':'0005777','GOTerm2':'0005739'}
r = requests.post(url, data=payload)`

All this returns is the webpage of GO Term. Substituting the url for GO Compare returns a web page with the status code 500, and no similarity value. I am very new to HTTP requests, so I am not sure how to proceed.

Am I misunderstanding the source code of both web pages? Or do I have a misunderstanding about HTTP requests? Thanks again.

Edit : I realized I was not clear about what I'm trying to do. Essentially, I'm trying to send two GO terms to G-SESAME, the website, and get back the numeric similarity of these two terms.

Upvotes: 2

Views: 2573

Answers (1)

zjk
zjk

Reputation: 2163

Try this:

url = 'http://bioinformatics.clemson.edu/G-SESAME/Program/GOCompareTwo2.php'
GOterms = {'GOTerm1':'0005777','GOTerm2':'0005739', 'submit':'Submit'}
r = requests.post(url, data=GOterms)
print r.text

You can try to mimic the browser request by inspecting the info in the network tab of the developer tools

Upvotes: 2

Related Questions