Catch TypeError if port is not set#567
Closed
Azd325 wants to merge 1 commit intoelastic:masterfrom
Azd325:master
Closed
Catch TypeError if port is not set#567Azd325 wants to merge 1 commit intoelastic:masterfrom Azd325:master
Azd325 wants to merge 1 commit intoelastic:masterfrom
Azd325:master
Conversation
If the port not found in the parse result the instrumentation will fail with `int() argument must be a string, a bytes-like object or a number, not 'NoneType'`
Contributor
|
@Azd325 great catch, thanks for opening the pull request. If you're up for it, would you mind adding a test for this case? It could look similar to the existing test, but open e.g. "http://example.com" (hitting an external URL in a test is usually not a fantastic idea, but in this case it looks like we can't really avoid it). If you don't have time, don't worry, I'll add a test and merge it tomorrow. |
Closed
Contributor
|
This is now released in v5.1.1. Thanks again for your contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If the port not found in the parse result the instrumentation will fail with
int() argument must be a string, a bytes-like object or a number, not 'NoneType'Reproducing
document = feedparser.parse("https://www.python.org/jobs/feed/rss/")int() argument must be a string, a bytes-like object or a number, not 'NoneType'apm-agent-python/elasticapm/instrumentation/packages/urllib.py
Line 51 in a55ec2c
It comes from here it seems the typeerror is not handled
Our workaround in the moment is this to set directly the port.
document = feedparser.parse("https://www.python.org:443/jobs/feed/rss/")