import json
import sseclient


def with_requests(url, headers,params):
    """Get a streaming response for the given event feed using requests."""
    import requests
    return requests.get(url, stream=True, headers=headers,params=params)


url = 'http://bitagent.sit.ninetechone.com/api/chat/read'
headers = {'Accept': 'text/event-stream'}
params = {
    'sessionId':"CB_01688938df2f4c30a81fe6b6c5ca7016",
    "streamId":"CB_261b4296d3fa4fe1bdb9fc638580d185",
    "access_token":"Bearer c1391926-e8ba-46c0-a0d1-c5e3c38503da"
}
response = with_requests(url, headers,params)  # or with_requests(url, headers)
client = sseclient.SSEClient(response)
for event in client.events():
    print(json.loads(event.data))


# print(get_expId('http://bitagent.sit.ninetechone.com/api/chat/read','CB_01688938df2f4c30a81fe6b6c5ca7016','CB_261b4296d3fa4fe1bdb9fc638580d185','Bearer c1391926-e8ba-46c0-a0d1-c5e3c38503da'))
# print(get_expId('http://bitagent.sit.ninetechone.com/api/chat/read','CB_e48bea09fe1e4c8388883ff11384bef8','CB_0e7c9c99d6494d9f977b0c2fbb73e2e3','Bearer c1391926-e8ba-46c0-a0d1-c5e3c38503da',10))
