Open sepehr opened 7 years ago
Hi @sepehr, Thanks for reporting this. I was assuming that Python would already automatically respect your proxy settings. I will look into a solution for this...
Hi @sepehr, So it looks like that the Google Python client that I bundled with the workflow didn't support SOCKS proxies. Could you please download and try out the following updated version of the workflow: Gmail-Client-for-Alfred.alfredworkflow.zip. Let me know if that works for you, otherwise I need to dig deeper.
Hey @fniephaus,
Thank you so much for looking into this 🙏
I just installed it, now it does not even list the primary actions. Here's the debug log:
[2017-04-19 17:07:35][ERROR: input.scriptfilter] Code 1: Traceback (most recent call last):
File "gmail.py", line 2, in <module>
from gmail_refresh import refresh_cache
File "/Users/Sepehr/Dropbox/dev/dotfiles/conf/app/alfred/Alfred.alfredpreferences/workflows/user.workflow.A06A4C55-CF30-4DAA-9ED8-A6C15CA10B7F/gmail_refresh.py", line 10, in <module>
from oauth2client.tools import run
ImportError: cannot import name run
I fixed the exception in the gmail_refresh.py
:
from oauth2client.tools import run_flow as run
Now, it shows me a "No mails found!" message while there is:
Here's the debug log with the updated python file:
[2017-04-19 17:12:39][STDERR: input.scriptfilter] 17:12:38 workflow.py:1628 DEBUG Reading settings from `/Users/Sepehr/Library/Application Support/Alfred 3/Workflow Data/com.fniephaus.gmail/settings.json` ...
17:12:38 workflow.py:2394 DEBUG Last run version : 1.2.0
17:12:38 workflow.py:2394 DEBUG Last run version : 1.2.0
17:12:38 workflow.py:2444 DEBUG update_data : None
17:12:38 workflow.py:1859 DEBUG Loading cached data from : /Users/Sepehr/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/com.fniephaus.gmail/gmail_inbox.cpickle
[2017-04-19 17:12:39][input.scriptfilter] <?xml version="1.0" encoding="utf-8"?>
<items><item autocomplete="" valid="no"><title>No mails found!</title><subtitle /><icon>icons/alert-dark.png</icon></item><item autocomplete="" valid="no"><title>...</title><subtitle /><icon>icons/mail-reply-dark.png</icon></item></items>
Whoops, thanks @sepehr. I still had the old .pyc
on my filesystem for some reason, but I'll update gmail_refresh.py
with your fix the next time I push to the repo.
Well, we are not sure if the proxy issue really is gone until you see your emails. Do you have Python scripts that work with your SOCKS proxy settings? httplib2
, which Google's Python API client uses, also comes with SocksiPy
, a Python SOCKS module. So I hope this respects your SOCKS settings. Let me know if you find out more...
Here's the situation with the new workflow:
So, I'm sure there's a problem with the new workflow. Is it working for you?
P. S. No, unfortunately, I don't have any existing scripts to test this out. But I look into it.
It is working for me. Maybe reauthenticate the workflow and try again. You can start from scratch after typing in gmail wf:deauth
which deletes your access token.
Re-authed the application, still the "No mails found!" message... everywhere.
Maybe have a look at the gmail_refresh.py
and see how the client works. Then, try to build a simple script that for example fetches entries from your inbox and prints them to stdout. Let me know if you need help. I have the slight feeling that there is something wrong with your setup or the Python client...
Thank you @fniephaus. Will do.
Would you please gimme a diff of what you've done with the python script to support the socks proxy?
No worries, @sepehr. I haven't really done anything but update all dependencies including httplib2
and the Google Python client. Maybe start with the client first and then try to get one of the examples working.
So, basically its the current HEAD
? right?
Yes, that's correct.
I'm pretty sure that the recent commits have introduced a new bug. I ran through the history with git bisect and found out that since 5b9e3ba, the workflow is returning that "No mails found!" message no matter what. The latest working snapshot for me is 344b42c.
And I think I found the issue. I'll open a pull request to address it. Please see #19:
With this fix, now I've returned to that "This service is not available from Iran" error when using the socks proxy. I'll look into it as soon as I can find some time.
Thanks!
Currently, the workflow's python script does not respect the globally set proxy:
That's unfortunate to say that Google blocks access to its Gmail API from Iranian IPs. So, basically, everyone needs to use some kinda VPN or proxy to access it here.
That'd be great (and much appreciated) the workflow could detect and use the system's set proxy.