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

"Not Acceptible!" error #49

Open
HunterZ opened this issue Oct 27, 2024 · 2 comments
Open

"Not Acceptible!" error #49

HunterZ opened this issue Oct 27, 2024 · 2 comments

Comments

@HunterZ
Copy link

HunterZ commented Oct 27, 2024

Getting the following error from the Bugzilla server when trying to run this:

Loading user cache...
Loading milestone cache...
Traceback (most recent call last):
  File "/home/x/projects/bugzilla2gitlab/venv/bin/bugzilla2gitlab", line 26, in <module>
    main()
  File "/home/x/projects/bugzilla2gitlab/venv/bin/bugzilla2gitlab", line 23, in main
    client.migrate(bugs)
  File "/home/x/projects/bugzilla2gitlab/venv/lib64/python3.11/site-packages/bugzilla2gitlab/migrator.py", line 16, in migrate
    bugzilla_login(
  File "/home/x/projects/bugzilla2gitlab/venv/lib64/python3.11/site-packages/bugzilla2gitlab/utils.py", line 123, in bugzilla_login
    _perform_request(login_url, "get", json=False)
  File "/home/x/projects/bugzilla2gitlab/venv/lib64/python3.11/site-packages/bugzilla2gitlab/utils.py", line 46, in _perform_request
    raise Exception(
Exception: 406 failed requests: [Not Acceptable] Response: [b'<head><title>Not Acceptable!</title></head><body><h1>Not Acceptable!</h1><p>An appropriate representation of the requested resource could not be found on this server. This error was generated by Mod_Security.</p></body></html>'] Request data: [{}] Url: [http://abc.xyz.com/bugzilla/index.cgi] Headers: [{}]
@HunterZ
Copy link
Author

HunterZ commented Oct 27, 2024

Added a user agent to the header, and now I'm getting 401 Unauthorized from gitlab.com when trying to read milestones.

@HunterZ
Copy link
Author

HunterZ commented Oct 27, 2024

Okay, the ultimate fix was to modify _perform_request() in utils.py to set the user agent there, because trying to set it in the config file apparently stomps the private token:

    headers["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0"

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

No branches or pull requests

1 participant