Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upValueError: invalid literal for int() with base 10 / hostname with 4 parts seems to interpreted as IPv4 address #105
Comments
|
My python is a bit vague. But If I just had a look at the code, it seems you're assuming that everything which has four "octets" qualifies for an IPv4 address. :-( In my case the hostname is If I edit So you maybe want to check e.g. for numbers or real octets before. |
|
I have a fix for this. It seems to be working in this particular location -- when I get a chance later today I'll do some more testing and do the same fix in other places that take an IPV4 address before submitting my PR. |
|
@bbeale just a hint, before you check on numbers only and next occasion another dude has a similar problem: hostnames also can contain numbers. There are several regex patterns out there which seem to do a good job |
|
@drwetter thanks for the tip. I think the regex that I ended up using should be sufficient, but the fix I added went a step further with the validation. It may have been overkill. You're right though, there were several patterns just within the first couple search results. |
|
I had a similar problem once in my project and I found the patterns quite useful. |
|
Stale issue message |


Happens both on Debian 10 and with a docker image (via docker build).
Supplied hostname resolves fine but has
probablynot one A record but a CNAME record which has two A name records.