Skip to content
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

get_job_profile returns 401 #37

Closed
eprikazc opened this issue Aug 9, 2019 · 4 comments
Closed

get_job_profile returns 401 #37

eprikazc opened this issue Aug 9, 2019 · 4 comments
Assignees
Labels

Comments

@eprikazc
Copy link

eprikazc commented Aug 9, 2019

Try following code:

import upwork
c = upwork.Client(PUBLIC_KEY, SECRET_KEY, ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
c.job.get_job_profile('~01039b34ec50422991')

get_job_profile call fails with following exception:

Traceback (most recent call last):
  File "test.py", line 17, in <module>
    c.job.get_job_profile('~01039b34ec50422991')
  File ".venv/lib/python3.6/site-packages/upwork/routers/job.py", line 45, in get_job_profile
    result = self.get(url)
  File ".venv/lib/python3.6/site-packages/upwork/namespaces.py", line 34, in get
    return self.client.get(self.full_url(url), data)
  File ".venv/lib/python3.6/site-packages/upwork/client.py", line 177, in get
    return self.read(url, data, method='GET', fmt=self.fmt)
  File ".venv/lib/python3.6/site-packages/upwork/client.py", line 294, in read
    raise_http_error(url, response)
  File ".venv/lib/python3.6/site-packages/upwork/http.py", line 41, in raise_http_error
    headers, None)
upwork.exceptions.HTTP401UnauthorizedError: HTTP Error 401: Code 401: Verification of signature failed.

The issue exists only with urllib3==1.25+. With urllib3==1.24.2 it works ok. Looks like the issue is caused by the the way urllib3==1.25+ treats URLs containing ~ - this symbol gets encoded to %7E.

@mnovozhylov
Copy link
Contributor

@eprikazc , good catch!
Might it makes sense to file an issue in urllib3 project - https://github.com/urllib3/urllib3/issues

@eprikazc
Copy link
Author

eprikazc commented Aug 9, 2019

@mnovozhylov - To file an issue in urllib3 we need to come up with scenario not specific to upwork.
I created simple flask app with route that contains ~, then made request to it via urllib3 and it worked ok. So, likely urllib3 works according to specs/standards and we need to investigate why exactly it fails in our case.
Or probably it would be easier to switch from using urllib3 to requests?
Or at the very least, update setup.py to require urllib3==1.24.2? (rather than 1.25.3)
https://github.com/upwork/python-upwork/blob/master/setup.py#L79

@mnovozhylov
Copy link
Contributor

OK, apparently, it came in this commit - 31bc917 during fixing https://nvd.nist.gov/vuln/detail/CVE-2019-11324. I've rechecked the report and according to it 1.24.2 should be safe.
So, I'll provide an update soon. Please, stay tuned.

@mnovozhylov mnovozhylov self-assigned this Aug 10, 2019
mnovozhylov added a commit that referenced this issue Aug 10, 2019
mnovozhylov added a commit that referenced this issue Aug 10, 2019
@mnovozhylov
Copy link
Contributor

Please, update to v1.3.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants