JessicaYeh / rom-exchange-web

ROM Exchange - Ragnarok M: Eternal Love Exchange Price History
https://www.romexchange.com
75 stars 18 forks source link

unable to fetch data from the api #21

Open nilsontan opened 5 years ago

nilsontan commented 5 years ago

Hi Jessica,

I get this error when trying to consume your api with axios.

Access to XMLHttpRequest at 'https://www.romexchange.com/api?item=mastela&exact=false' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

JessicaYeh commented 5 years ago

Hi @nilsontan! Unfortunately I'm unable to remove that restriction at the moment (it's a limitation of the web host). I'll keep searching for the best workaround for it. I know it kind of makes it difficult to create your own web client using the API (non-web tools like bots and command line programs are unaffected) until that restriction is removed.

nezam7 commented 5 years ago

let me know if u manage the data available. been trying to pull the data myself only stumbled upon this comment. cheers

SinueeHernandez commented 4 years ago

You just need to add the header 'User-Agent'. The next example is on python


x = requests.get(
    'https://www.romexchange.com/api',
    params={'item':item},
    headers={'User-Agent': 'RomCalculator/0.0.1'})