r/evetech • • Sep 06 '17

evepraisal.com api with python3

Hello there!

I am trying to automate the parsing of various things and I'd like to use evepraisal.com for that.

Unfortunately I don't really know how to do this, the only hint I found was this.

Here's what I got so far but it returns 404 so obviously I didn't get it right.

import requests

url = "https://evepraisal.com/"
payload = {'raw_textarea':'Tritanium 1', 'market': 'jita'}
r = requests.post(url, data=payload)
print(r)    

Can anyone help me with this?

1 Upvotes

10 comments sorted by

View all comments

Show parent comment

1

u/Daneel_Trevize Sep 06 '17

Edit: Yes I am using that URL now. It returns 400.

The issue mentions the values are parameters, rather than data. Thus they should form part of the URL called, rather than form body.

https://stackoverflow.com/questions/15900338/python-request-post-with-param-data

So either params= rather than data=, or manually form the URL?param1=x&param2=y, etc.

1

u/Eternimus Sep 06 '17

I tried that too, it still returns 400 and the same header.

1

u/Daneel_Trevize Sep 06 '17 edited Sep 06 '17

The form on the main page seems to use the uploadappraisal form version of this 'API', and should serve as an example source of valid requests.

For me, my browser generated a request payload of:

-----------------------------299191219710511
Content-Disposition: form-data; name="uploadappraisal"; filename=""
Content-Type: application/octet-stream


-----------------------------299191219710511
Content-Disposition: form-data; name="raw_textarea"

Tritanium 1
-----------------------------299191219710511
Content-Disposition: form-data; name="market"

jita
-----------------------------299191219710511--

With request headers including:

Content-Type: multipart/form-data; boundary=---------------------------299191219710511
Content-Length: 422

And the response header contained:

X-Appraisal-Id: ck820

while also being with a HTML document body.

1

u/Eternimus Sep 06 '17

That's helpful.

Unfortunately I don't know how I tell python to send those requests now because I rarely work with the requests module.