-
Notifications
You must be signed in to change notification settings - Fork 100
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
Ashford Borough Council #389
Comments
I can't seem to resolve the following SSL protocol error that's happening trying to make a get request to this URL: I've tried the usual with no change: requests.packages.urllib3.disable_warnings() Testing it with SSL Labs reports it to only support TLS 1.2: https://www.ssllabs.com/ssltest/analyze.html?d=secure.ashford.gov.uk From this, I attempted to force the request to use TLS 1.2, but the same error persists: class CustomHttpAdapter(requests.adapters.HTTPAdapter):
"""Transport adapter" that allows us to use custom ssl_context."""
def __init__(self, ssl_context=None, **kwargs):
self.ssl_context = ssl_context
super().__init__(**kwargs)
def init_poolmanager(self, connections, maxsize, block=False):
self.poolmanager = urllib3.poolmanager.PoolManager(
num_pools=connections,
maxsize=maxsize,
block=block,
ssl_context=self.ssl_context,
)
class CouncilClass(AbstractGetBinDataClass):
def parse_data(self, page: str, **kwargs) -> dict:
# Start a new session to walk through the form
s = requests.Session()
ssl_context = ssl.create_default_context()
ssl_context.minimum_version = ssl.TLSVersion.TLSv1
ssl_context.maximum_version = ssl.TLSVersion.TLSv1_2
ssl_context.options = ssl.PROTOCOL_TLS & ssl.OP_NO_TLSv1_3
s.mount("https://", CustomHttpAdapter(ssl_context))
requests.packages.urllib3.disable_warnings()
# Get our initial session running
response = s.get("https://secure.ashford.gov.uk/waste/collectiondaylookup/") Full script with the above attempt in it: https://github.com/OliverCullimore/UKBinCollectionData/tree/389-ashford-borough @dp247 @robbrad any ideas here or should we resort to Selenium? |
@OliverCullimore resort to Selenium - use branch https://github.com/robbrad/UKBinCollectionData/tree/council_pack_3 |
Name of Council
Ashford Borough Council
Example Address/Postcode
TN23 7SP (Any of the numbered addresses, not businesses)
Additional Information
https://secure.ashford.gov.uk/WasteCollections/CollectionDayLookup/ this website allows you to lookup postcode, then it asks you for address
Verification
The text was updated successfully, but these errors were encountered: