rom-exchange-web
rom-exchange-web copied to clipboard
unable to fetch data from the api
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.
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.
let me know if u manage the data available. been trying to pull the data myself only stumbled upon this comment. cheers
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'})