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

Fixed auth #12

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

medeirosjoaquim
Copy link

Created auth(gituser, gitpass) and testauth() methods.

To solve the issue (#11) I had to create an auth method using github3.py.

@jwass
Copy link
Owner

jwass commented Jun 5, 2018

Hi @medeirosjoaquim,
Thanks for contributing this!

Any chance you can get the tests running so this can be merged?

@Sti2nd
Copy link

Sti2nd commented Oct 31, 2018

Please fix this!

@medeirosjoaquim
Copy link
Author

Please fix this!

Done!

@medeirosjoaquim
Copy link
Author

Hi @medeirosjoaquim,
Thanks for contributing this!

Any chance you can get the tests running so this can be merged?

It's done.

@Sti2nd
Copy link

Sti2nd commented Nov 6, 2018

Wow! Great! Thank you @medeirosjoaquim ❤️

@hyperknot
Copy link

hyperknot commented Jan 17, 2019

How do you install this non-released fix? I'm trying everything like

pip install git+https:///github.com/jwass/geojsonio.py.git@master

But it still results in exception:

File "venv/lib/python3.7/site-packages/geojsonio/geojsonio.py", line 36, in display
    url = make_url(contents, domain, force_gist)
  File "venv/lib/python3.7/site-packages/geojsonio/geojsonio.py", line 93, in make_url
    gist = _make_gist(contents)
  File "venv/lib/python3.7/site-packages/geojsonio/geojsonio.py", line 172, in _make_gist
    gist = ghapi.create_gist(description, files)
  File "venv/lib/python3.7/site-packages/github3/decorators.py", line 37, in auth_wrapper
    raise error_for(r)
github3.exceptions.AuthenticationFailed: 401 Requires authentication

@medeirosjoaquim
Copy link
Author

How do you install this non-released fix? I'm trying everything like

pip install git+https:///github.com/jwass/geojsonio.py.git@master

But it still results in exception:

File "venv/lib/python3.7/site-packages/geojsonio/geojsonio.py", line 36, in display
    url = make_url(contents, domain, force_gist)
  File "venv/lib/python3.7/site-packages/geojsonio/geojsonio.py", line 93, in make_url
    gist = _make_gist(contents)
  File "venv/lib/python3.7/site-packages/geojsonio/geojsonio.py", line 172, in _make_gist
    gist = ghapi.create_gist(description, files)
  File "venv/lib/python3.7/site-packages/github3/decorators.py", line 37, in auth_wrapper
    raise error_for(r)
github3.exceptions.AuthenticationFailed: 401 Requires authentication

while it's not merged , you can try it from the fork I've made to implement the fix, here
https://github.com/medeirosjoaquim/PyGeoJson

although I've made it kinda in a hurry to pass the tests in the repo. Try it and tell my if it works alright. If
not, send me the errors.

@xindi-dumbledore
Copy link

xindi-dumbledore commented Feb 2, 2019

I have AttributeError: module 'geojsonio' has no attribute 'auth' when doing

myAuth = geojsonio.auth('username','password')

Also, the documentation on the fork is kind of misleading since it still suggest doing pip install geojsonio... Additionally I got super confused because seems from the original source code, I should put a gitauth.txt?

@medeirosjoaquim
Copy link
Author

I have AttributeError: module 'geojsonio' has no attribute 'auth' when doing

myAuth = geojsonio.auth('username','password')

Also, the documentation on the fork is kind of misleading since it still suggest doing pip install geojsonio... Additionally I got super confused because seems from the original source code, I should put a gitauth.txt?

It's not documentation of the fork. In fact, it's not a fork. I forked for those who wanted to try the fix because it's a PR and it's waiting for the maintainer to merge. I did the fix almos a year ago and only a few months ago I finished the tests. If in some weekend to come I have the time, I will try to put it in order and then I reply here. Thanks for your comment!

@medeirosjoaquim
Copy link
Author

I have AttributeError: module 'geojsonio' has no attribute 'auth' when doing

myAuth = geojsonio.auth('username','password')

Also, the documentation on the fork is kind of misleading since it still suggest doing pip install geojsonio... Additionally I got super confused because seems from the original source code, I should put a gitauth.txt?

I just made a little clean up in the read-me file, and tested again the fix. Works ok.

You will not install it.
You must have the gitauth.txt in the same folder as the geojsonio.py and then
just run the script (python geojsonio.py yourdataset.geojson)...
Hope it helps.
you can check my test here : https://gist.github.com/medeirosjoaquim/ba7df592d29f1e358f3f249bb1cbbce4

@SuryaSankar
Copy link

Can this be merged please? This issue is blocking the adoption of this library

@medeirosjoaquim
Copy link
Author

Can this be merged please? This issue is blocking the adoption of this library

in the meanwhile, you can use the fork with the fix. You don't need to pip install, just get the files, put your credentials and run.

https://github.com/medeirosjoaquim/PyGeoJson

@BizYoder
Copy link

Hi @medeirosjoaquim, I can't get your solution to work. I keep getting the following:

Bizs-MacBook-Pro:PyGeoJson-master bizyoder$ python geojsonio.py africagrid20170906existing.geojson
Traceback (most recent call last):
File "geojsonio.py", line 236, in
main()
File "geojsonio.py", line 229, in main
url = make_url(contents, args.domain)
File "geojsonio.py", line 106, in make_url
gist = _make_gist(contents)
File "geojsonio.py", line 186, in _make_gist
gist = gh.create_gist(description, files)
File "/Users/bizyoder/anaconda3/lib/python3.6/site-packages/github3/github.py", line 149, in create_gist
json = self._json(self._post(url, data=new_gist), 201)
File "/Users/bizyoder/anaconda3/lib/python3.6/site-packages/github3/models.py", line 90, in _json
if self._boolean(response, status_code, 404) and response.content:
File "/Users/bizyoder/anaconda3/lib/python3.6/site-packages/github3/models.py", line 108, in _boolean
raise GitHubError(response)
github3.models.GitHubError: 502 Server Error

Any thoughts?

@medeirosjoaquim
Copy link
Author

github3.models.GitHubError: 502 Server Error

Hi! How are you? I will take a look. But, since it's a 502 error, it looks like a Github's downtime.
I would be nice if the fix were merged to work on this.

@medeirosjoaquim
Copy link
Author

Hi @medeirosjoaquim, I can't get your solution to work. I keep getting the following:

Bizs-MacBook-Pro:PyGeoJson-master bizyoder$ python geojsonio.py africagrid20170906existing.geojson
Traceback (most recent call last):
File "geojsonio.py", line 236, in
main()
File "geojsonio.py", line 229, in main
url = make_url(contents, args.domain)
File "geojsonio.py", line 106, in make_url
gist = _make_gist(contents)
File "geojsonio.py", line 186, in _make_gist
gist = gh.create_gist(description, files)
File "/Users/bizyoder/anaconda3/lib/python3.6/site-packages/github3/github.py", line 149, in create_gist
json = self._json(self._post(url, data=new_gist), 201)
File "/Users/bizyoder/anaconda3/lib/python3.6/site-packages/github3/models.py", line 90, in _json
if self._boolean(response, status_code, 404) and response.content:
File "/Users/bizyoder/anaconda3/lib/python3.6/site-packages/github3/models.py", line 108, in _boolean
raise GitHubError(response)
github3.models.GitHubError: 502 Server Error

Any thoughts?

Hi! I took a look,. it still works fine here. I've noticed that you're using python3. This repo was set first with python 2.7 . Would you mind trying to run it with python 2.7 and then tell me if it works? Perhaps
in the python 3 lib for github api the URLs are different and, because of that, it's receiving this 502 error.

@medeirosjoaquim
Copy link
Author

UPDATE:

Now you should use an ACCESS TOKEN. It's cleaner and safer. just go to my fork and follow the instructions:

https://github.com/medeirosjoaquim/PyGeoJson

@ShrimpandGits
Copy link

a suggestion, I don't know if Git updated Auth tokens, but I ran into some trouble last night:

The new path is:

Settings > Developer settings > Personal access tokens

Select scopes:

gist - Create gists (checked)

@ShAssaf
Copy link

ShAssaf commented Feb 4, 2023

Hi, still having this issue

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

Successfully merging this pull request may close these issues.

9 participants