fb_dtsg is sometimes returned inside an HTML comment, and beautifulsoup can't find it - in that case we'll use a regular expression to extract it. fb_h is sometimes not returned in the HTML of req_url.BASE (in my experience, when resuming a session using session_cookies). Following the discussion here: https://github.com/Schmavery/facebook-chat-api/issues/505 I learned it is used for logging out, and can be found in the response of `https://www.facebook.com/bluebar/modern_settings_menu/`. I included support for fetching it from there. Because this library is used many more times for logging in, than for logging out, instead of adding an extra HTTP request during login, I decided to perform it during logout, only in case fb_h is not found in the HTML of req_url.BASE.