Skip to content

Add options to specify user agent and keep inner HTML - #44

Open
jakewilliami wants to merge 4 commits into
nfx:mainfrom
jakewilliami:main
Open

Add options to specify user agent and keep inner HTML#44
jakewilliami wants to merge 4 commits into
nfx:mainfrom
jakewilliami:main

Conversation

@jakewilliami

Copy link
Copy Markdown

This PR primarily adds an option to retain the inner HTML of each row of the table (closing #37).

However, unit tests were failing, in part due to Wikipedia blocking requests without a valid user agent (an error which I have encountered when trying to use this package in the past). So, I thought it appropriate to implement another option to allow the user agent to be configurable, and to set a default user agent for all requests to minimise the likelihood that requests are blocked.

So the API now allows for amended options to every relevant call. For example:

NewSliceFromURL[T](url, WithInnerHTML(), WithUserAgent("go-htmltable/0.5.0"))

We need a way to be able to pass optional settings to Page, in order
to change its behaviour.
Many websites will now require a user agent.  Even Wikipedia is
blocking our requests in our unit tests.  We now allow a user agent to
be set for HTTP queries.  We also specify a default user agent to use
if none is set by the user.
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.

1 participant