Skip to content
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

Exception: key 'Com.Android.Browser.Application-Id' must not contain '.' #80

Open
mickeygjk opened this issue Mar 12, 2018 · 0 comments

Comments

@mickeygjk
Copy link

flask-profiler seems not able to handle http requests with fields containing dot. probably need to sanitize the key for mongo before insertion.

Exception: key 'Com.Android.Browser.Application-Id' must not contain '.'
On Request: {'data': '', 'stream': <cStringIO.StringO object at 0x7fd978db7e30>, '_cached_data': '', 'headers': EnvironHeaders([('Total-Route-Time', u'0'), ('Accept', u'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8,UC/145'), ('User-Agent', u'Mozilla/5.0 (Linux; Android 8.0.0; BLA-AL00 Build/HUAWEIBLA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Mobile Safari/537.36'), ('Connection', u'close'), ('Host', u'www.waitfreesln.com'), ('X-Request-Start', u'1519071553385'), ('Com.Android.Browser.Application-Id', u'com.android.mms'), ('Accept-Language', u'en-US'), ('X-Forwarded-For', u'172.58.41.145'), ('X-Forwarded-Port', u'443'), ('X-Request-Id', u'64ef5219-bc8e-4f07-b09b-cbdf2b40ebc5'), ('Accept-Encoding', u'gzip, deflate, br'), ('Connect-Time', u'0'), ('X-Forwarded-Proto', u'https'), ('Via', u'1.1 vegur')]), 'cookies': {}, 'shallow': False, 'url_rule': <Rule '/t/' (OPTIONS, GET, HEAD) -> frontend.catch_all>, 'base_url': u'https://www.waitfreesln.com/t/05c180', 'args': ImmutableMultiDict([]), 'form': ImmutableMultiDict([]), 'files': ImmutableMultiDict([]), 'environ': {'SERVER_SOFTWARE': 'gunicorn/19.6.0', 'wsgi.errors': <gunicorn.http.wsgi.WSGIErrorsWrapper object at 0x7fd97909c290>, 'HTTP_TOTAL_ROUTE_TIME': '0', 'REMOTE_ADDR': '10.142.224.246', 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8,UC/145', 'wsgi.version': (1, 0), 'RAW_URI': '/t/05c180', 'wsgi.input': <gunicorn.http.body.Body object at 0x7fd97a696890>, 'HTTP_USER_AGENT': 'Mozilla/5.0 (Linux; Android 8.0.0; BLA-AL00 Build/HUAWEIBLA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Mobile Safari/537.36', 'HTTP_CONNECTION': 'close', 'wsgi.multithread': False, 'wsgi.url_scheme': 'https', 'HTTP_HOST': 'www.waitfreesln.com', 'SERVER_NAME': '0.0.0.0', 'HTTP_X_REQUEST_START': '1519071553385', 'wsgi.file_wrapper': <class 'gunicorn.http.wsgi.FileWrapper'>, 'HTTP_COM.ANDROID.BROWSER.APPLICATION_ID': 'com.android.mms', 'HTTP_ACCEPT_LANGUAGE': 'en-US', 'werkzeug.request': <Request 'https://www.waitfreesln.com/t/05c180' [GET]>, 'HTTP_X_FORWARDED_FOR': '172.58.41.145', 'gunicorn.socket': <socket._socketobject object at 0x7fd974dc6750>, 'HTTP_X_FORWARDED_PORT': '443', 'SERVER_PORT': '6057', 'REMOTE_PORT': '31415', 'QUERY_STRING': '', 'HTTP_X_REQUEST_ID': '64ef5219-bc8e-4f07-b09b-cbdf2b40ebc5', 'PATH_INFO': '/t/05c180', 'wsgi.multiprocess': True, 'SCRIPT_NAME': '', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate, br', 'HTTP_CONNECT_TIME': '0', 'HTTP_X_FORWARDED_PROTO': 'https', 'REQUEST_METHOD': 'GET', 'SERVER_PROTOCOL': 'HTTP/1.1', 'wsgi.run_once': False, 'HTTP_VIA': '1.1 vegur'}, 'view_args': {'path': u'05c180'}}
Traceback: Traceback (most recent call last):
File "/app/.heroku/python/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/app/.heroku/python/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functionsrule.endpoint
File "/app/.heroku/python/lib/python2.7/site-packages/flask_profiler/flask_profiler.py", line 137, in wrapper
return wrapped(*args, **kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/flask_profiler/flask_profiler.py", line 116, in wrapper
collection.insert(measurement.json())
File "/app/.heroku/python/lib/python2.7/site-packages/flask_profiler/storage/mongo.py", line 89, in insert
result = self.collection.insert(measurement)
File "/app/.heroku/python/lib/python2.7/site-packages/pymongo/collection.py", line 2212, in insert
check_keys, manipulate, write_concern)
File "/app/.heroku/python/lib/python2.7/site-packages/pymongo/collection.py", line 535, in _insert
check_keys, manipulate, write_concern, op_id, bypass_doc_val)
File "/app/.heroku/python/lib/python2.7/site-packages/pymongo/collection.py", line 516, in _insert_one
check_keys=check_keys)
File "/app/.heroku/python/lib/python2.7/site-packages/pymongo/pool.py", line 244, in command
self._raise_connection_failure(error)
File "/app/.heroku/python/lib/python2.7/site-packages/pymongo/pool.py", line 372, in _raise_connection_failure
raise error
InvalidDocument: key 'Com.Android.Browser.Application-Id' must not contain '.'

fatihsucu pushed a commit to fatihsucu/flask-profiler that referenced this issue Apr 2, 2018
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

No branches or pull requests

1 participant