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

Error - HTTP verb used to access this page is not allowed #8

Open
moneals opened this issue Nov 22, 2016 · 8 comments
Open

Error - HTTP verb used to access this page is not allowed #8

moneals opened this issue Nov 22, 2016 · 8 comments

Comments

@moneals
Copy link

moneals commented Nov 22, 2016

Periodically I get the following error response when checking domain availability. When I retry with the same domain it is usually successful. This is being run inside a script that executes a large volume of domain check requests sequentially.

--- Request ---
https://api.namecheap.com/xml.response?UserName=xxxxxx&ApiKey=xxxxxxxxxxx&DomainList=example.com&ApiUser=xxxxxx&Command=namecheap.domain s.check&ClientIP=11.11.11.11
{}
--- Response ---

<title>405 - HTTP verb used to access this page is not allowed.</title> <style type="text/css"> </style>

Server Error

405 - HTTP verb used to access this page is not allowed.

The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access.

@agrrh
Copy link
Contributor

agrrh commented Nov 23, 2016

Hello!

Which version of PyNamecheap are you using? Please provide a commit hash.

It's possible that issue is about replacing URI params with POST data when large (>10) amount of items is present.

@Bemmu
Copy link
Owner

Bemmu commented Nov 24, 2016

How many domains is "large volume?". I think the API is not intended to be used as a bulk checking tool.

@moneals
Copy link
Author

moneals commented Dec 4, 2016

agrrh:
commit 0162105

Bemmu:
It's not really being done as a bulk checking tool. If I sequentially run through a list of a few dozen domains and check one domain at a time I regularly get the error after a few checks.

@agrrh
Copy link
Contributor

agrrh commented Dec 5, 2016

@michaeos
You could try then upgrade to current master or to 55a285a
Both of them contain fix that could resolve the issue, if I get it right.

@gstein
Copy link
Contributor

gstein commented Aug 8, 2017

I am getting the same error, when invoking namecheap.domains.getInfo for a single domain (via a subclass that I have to perform that method). So this is definitely not related to request size, but (I would guess) a sporadic error thrown by the API endpoint.

Would you like PyNamecheap to automatically retry when this error happens, or should the application do the retry?

If you would like the application to perform the retry, then I suggest throwing a better exception. Here is partial traceback, for when the error is thrown:

File "...", line 103, in domains_getInfo
xml = self._call('namecheap.domains.getInfo', extra_payload)
File .../PyNamecheap/namecheap.py", line 116, in _call
xml = self._fetch_xml(payload, extra_payload)
File ".../PyNamecheap/namecheap.py", line 105, in _fetch_xml
if xml.attrib['Status'] == 'ERROR':
KeyError: 'Status'

The KeyError should probably be replaced by ApiError() or some other specific exception, to make it easier for the app to detect and retry.

@gstein
Copy link
Contributor

gstein commented Aug 8, 2017

Oh, the point to my prior comment: provide a direction, and I'll supply a patch.

@agrrh
Copy link
Contributor

agrrh commented Aug 8, 2017

@gstein
I suppose it's application responsibility to handle such retries.

Would you agree that retry_count and retry_delay values are too app's logic dependent? So idea to provide proper ApiError exception is a great way to solve the issue.

Here's quick and untested patch to do so, just in case you don't want to spend time: #14

Still looking forward to see your version which I suppose would be better.

@gstein
Copy link
Contributor

gstein commented Aug 8, 2017

Well ... I could see passing those two values into the Api object (along with suitable parameter defaults), and have it perform retrying internally.

Otherwise, I would switch my Api usage code from:
domains = api.domains_getList(PageSize=100)
to:
domains = _retry(api.domains_getList, PageSize=100)

I think that I'd prefer of the Api object retried, to keep app code cleaner. But it's your code :-) ... I'll supply either style of patch.

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

4 participants