New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid Query #24

Closed
jonathannz opened this Issue Sep 18, 2017 · 19 comments

Comments

Projects
None yet
@jonathannz

jonathannz commented Sep 18, 2017

This workflow has ceased working in the past week or so. I get an "Invalid query" error, no matter what I do. It's been working fine for the past year or more. Has something changed online (with whatever APIs it interacts with), requiring it to be updated?

@Nexilus

This comment has been minimized.

Show comment
Hide comment
@Nexilus

Nexilus Sep 18, 2017

I have the same issue, checked and atleast the google finance API seems the same, however not sure if they have added any curl-rest restrictions or something, trying to poke around in the code to see if i can see anything from a novice point of view.

Nexilus commented Sep 18, 2017

I have the same issue, checked and atleast the google finance API seems the same, however not sure if they have added any curl-rest restrictions or something, trying to poke around in the code to see if i can see anything from a novice point of view.

@Nexilus

This comment has been minimized.

Show comment
Hide comment
@Nexilus

Nexilus Sep 18, 2017

I may be wrong, but i think the alfred-update is what broke this plugin, i just did the google finance API-part in my own plugin with simple file_get_contents and dom-parsing, works great, so i believe alfred maybe changed the way script-filters work or something, becuase the backend seems fine. (Well except for the BTC stuff that is using an obsolete API)

Nexilus commented Sep 18, 2017

I may be wrong, but i think the alfred-update is what broke this plugin, i just did the google finance API-part in my own plugin with simple file_get_contents and dom-parsing, works great, so i believe alfred maybe changed the way script-filters work or something, becuase the backend seems fine. (Well except for the BTC stuff that is using an obsolete API)

@NilsDannemann

This comment has been minimized.

Show comment
Hide comment
@NilsDannemann

NilsDannemann Sep 18, 2017

Would love a solution for this as well. Was a great help so far!

NilsDannemann commented Sep 18, 2017

Would love a solution for this as well. Was a great help so far!

@AlexWang-16

This comment has been minimized.

Show comment
Hide comment
@AlexWang-16

AlexWang-16 Sep 19, 2017

I'm also looking forward to a fix for this issue. This is a plugin I use regularly.

AlexWang-16 commented Sep 19, 2017

I'm also looking forward to a fix for this issue. This is a plugin I use regularly.

@woodyc79

This comment has been minimized.

Show comment
Hide comment
@woodyc79

woodyc79 Sep 19, 2017

Same here, would be great if it was fixed!

woodyc79 commented Sep 19, 2017

Same here, would be great if it was fixed!

@Enochenti

This comment has been minimized.

Show comment
Hide comment
@Enochenti

Enochenti Sep 19, 2017

#22

Here is a simple solution.

Enochenti commented Sep 19, 2017

#22

Here is a simple solution.

@jonathannz

This comment has been minimized.

Show comment
Hide comment
@jonathannz

jonathannz Oct 4, 2017

Thanks @Enochenti .
I see the workflow author has not yet pulled your new code into the workflow. Looks like this workflow may be abandoned. No updates in 5 years.

For those who are looking for a solution to this issue...

View the workflow in Finder.
Edit the file: /libs/e4QuerySend.php

Change line 56. It is currently:
$response = $this->app->sendHTTPRequest('http://www.google.com/finance/converter?'.http_build_query(array(

Change it to:
$response = $this->app->sendHTTPRequest('https://finance.google.com/finance/converter?'.http_build_query(array(
You can view the required changes here, https://github.com/bigluck/alfred2-currencyconverter/pull/22/files - courtesy of Enochenti.
It will now work as before.

jonathannz commented Oct 4, 2017

Thanks @Enochenti .
I see the workflow author has not yet pulled your new code into the workflow. Looks like this workflow may be abandoned. No updates in 5 years.

For those who are looking for a solution to this issue...

View the workflow in Finder.
Edit the file: /libs/e4QuerySend.php

Change line 56. It is currently:
$response = $this->app->sendHTTPRequest('http://www.google.com/finance/converter?'.http_build_query(array(

Change it to:
$response = $this->app->sendHTTPRequest('https://finance.google.com/finance/converter?'.http_build_query(array(
You can view the required changes here, https://github.com/bigluck/alfred2-currencyconverter/pull/22/files - courtesy of Enochenti.
It will now work as before.

@woodyc79

This comment has been minimized.

Show comment
Hide comment
@woodyc79

woodyc79 Oct 4, 2017

woodyc79 commented Oct 4, 2017

@bao-xingchen

This comment has been minimized.

Show comment
Hide comment
@bao-xingchen

bao-xingchen commented Oct 21, 2017

Great job @jonathannz, thanks!

@NilsDannemann

This comment has been minimized.

Show comment
Hide comment
@NilsDannemann

NilsDannemann Oct 22, 2017

Amazing! Thanks a ton!

NilsDannemann commented Oct 22, 2017

Amazing! Thanks a ton!

@esthor

This comment has been minimized.

Show comment
Hide comment
@esthor

esthor Mar 14, 2018

I get every other currency working that I try, except SEK (Swedish Krona)...any ideas?

esthor commented Mar 14, 2018

I get every other currency working that I try, except SEK (Swedish Krona)...any ideas?

@viktorbijlenga

This comment has been minimized.

Show comment
Hide comment
@viktorbijlenga

viktorbijlenga Mar 20, 2018

The Google Finance API seems to be slowly dying. Does anyone know if there is a good alternative? It might be time to replace it with something else.

@esthor I get every other currency working that I try, except SEK (Swedish Krona)...any ideas?

I get the same issue for SEK. On stackoverflow there seems to be similar issues beeing noticed. https://stackoverflow.com/questions/46070126/google-finance-json-stock-quote-stopped-working#comment85598584_46125977

viktorbijlenga commented Mar 20, 2018

The Google Finance API seems to be slowly dying. Does anyone know if there is a good alternative? It might be time to replace it with something else.

@esthor I get every other currency working that I try, except SEK (Swedish Krona)...any ideas?

I get the same issue for SEK. On stackoverflow there seems to be similar issues beeing noticed. https://stackoverflow.com/questions/46070126/google-finance-json-stock-quote-stopped-working#comment85598584_46125977

@jonathannz

This comment has been minimized.

Show comment
Hide comment
@jonathannz

jonathannz Mar 20, 2018

Darn. As of sometime this month (march 2018) the invalid query error has returned. I am guessing another change has occurred with the API.

Looks like Google have now dropped their finance API entirely.
https://stackoverflow.com/a/49385274/1092677

jonathannz commented Mar 20, 2018

Darn. As of sometime this month (march 2018) the invalid query error has returned. I am guessing another change has occurred with the API.

Looks like Google have now dropped their finance API entirely.
https://stackoverflow.com/a/49385274/1092677

@jonathannz

This comment has been minimized.

Show comment
Hide comment
@jonathannz

jonathannz Mar 21, 2018

I suggest switching over to this workflow: http://www.packal.org/workflow/currency-exchange

It works well. It doesn't magically guess the currency when entering two digit country codes, as Currency Converter would, but so long as you put in the full three digit currency code, it's good to go.

@esthor : As a bonus, it works fine with SEK.

jonathannz commented Mar 21, 2018

I suggest switching over to this workflow: http://www.packal.org/workflow/currency-exchange

It works well. It doesn't magically guess the currency when entering two digit country codes, as Currency Converter would, but so long as you put in the full three digit currency code, it's good to go.

@esthor : As a bonus, it works fine with SEK.

@jonathannz jonathannz closed this Mar 21, 2018

@rauluranga

This comment has been minimized.

Show comment
Hide comment
@rauluranga

rauluranga Mar 21, 2018

or you can edit the file /libs/e4QuerySend.php and replace the function queryGoogle with the following:

protected function queryGoogle()
{
    $this->requestService = 'Fixer IO';
    $response = $this->app->sendHTTPRequest('http://api.fixer.io/latest?'.http_build_query(array(
        'base' => $this->from,
        'symbols' => $this->to)), null, 300);
    $json = json_decode($response, true);
    if ($json['rates'][$this->to]){
        $this->responseFromAmount = $this->amount;
        $this->responseFromCurrency = $this->from;
        $this->responseToAmount = number_format($this->amount * floatval($json['rates'][$this->to]), 2);
        $this->responseToCurrency = $this->to;
        return $this->valid = true;
    }

    return $this->valid = false;
}

now uses: fixer.io
using USD to MXN works for me! (haven't tested all currencies).

also you can rename the queryGoogle function to something more adequate, just remember to update the function call at sendRequest

rauluranga commented Mar 21, 2018

or you can edit the file /libs/e4QuerySend.php and replace the function queryGoogle with the following:

protected function queryGoogle()
{
    $this->requestService = 'Fixer IO';
    $response = $this->app->sendHTTPRequest('http://api.fixer.io/latest?'.http_build_query(array(
        'base' => $this->from,
        'symbols' => $this->to)), null, 300);
    $json = json_decode($response, true);
    if ($json['rates'][$this->to]){
        $this->responseFromAmount = $this->amount;
        $this->responseFromCurrency = $this->from;
        $this->responseToAmount = number_format($this->amount * floatval($json['rates'][$this->to]), 2);
        $this->responseToCurrency = $this->to;
        return $this->valid = true;
    }

    return $this->valid = false;
}

now uses: fixer.io
using USD to MXN works for me! (haven't tested all currencies).

also you can rename the queryGoogle function to something more adequate, just remember to update the function call at sendRequest

@AlexWang-16

This comment has been minimized.

Show comment
Hide comment
@AlexWang-16

AlexWang-16 Mar 21, 2018

@rauluranga Thanks for posting the code. Just a side note, I don't think it is possible to replace queryGoogle with sendRequest because a function with that name already exist in the code.

AlexWang-16 commented Mar 21, 2018

@rauluranga Thanks for posting the code. Just a side note, I don't think it is possible to replace queryGoogle with sendRequest because a function with that name already exist in the code.

@rauluranga

This comment has been minimized.

Show comment
Hide comment
@rauluranga

rauluranga Mar 21, 2018

yes i know, what i mean is that you can rename queryGoogle to something more adequate like queryFixer or something like that, but if you do that, you have to update the sendRequest function with the new name.

public function sendRequest()
{
    if ($this->from == 'BTC' || $this->to == 'BTC')
        return $this->queryBitcoin();
    return $this->queryFixer();
}

rauluranga commented Mar 21, 2018

yes i know, what i mean is that you can rename queryGoogle to something more adequate like queryFixer or something like that, but if you do that, you have to update the sendRequest function with the new name.

public function sendRequest()
{
    if ($this->from == 'BTC' || $this->to == 'BTC')
        return $this->queryBitcoin();
    return $this->queryFixer();
}
@Denis4yk

This comment has been minimized.

Show comment
Hide comment
@Denis4yk

Denis4yk Apr 21, 2018

Ehhh. I liked this package. Such a shame, that it's not supportable now.

Denis4yk commented Apr 21, 2018

Ehhh. I liked this package. Such a shame, that it's not supportable now.

@rafifyalda

This comment has been minimized.

Show comment
Hide comment
@rafifyalda

rafifyalda Apr 30, 2018

@rauluranga That API is set to be shut-down June 1st 2018. The new API allows 1000 requests per-month on the free tier, whereas https://free.currencyconverterapi.com allows 100 per-hour.

This API endpoint is deprecated and will stop working on June 1st, 2018. For more information please visit: https://github.com/fixerAPI/fixer#readme

I've got an open pull-request with a working alternative at #26.

Edit: Seems you might have some luck with this hidden Google URL. Unsure how long it will stick around though. #26 (comment)

rafifyalda commented Apr 30, 2018

@rauluranga That API is set to be shut-down June 1st 2018. The new API allows 1000 requests per-month on the free tier, whereas https://free.currencyconverterapi.com allows 100 per-hour.

This API endpoint is deprecated and will stop working on June 1st, 2018. For more information please visit: https://github.com/fixerAPI/fixer#readme

I've got an open pull-request with a working alternative at #26.

Edit: Seems you might have some luck with this hidden Google URL. Unsure how long it will stick around though. #26 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment