Burp...

POST /ShareWebServices/Services/General/LoginPublisherAccountByName HTTP/1.1 Host: share2.dexcom.com Content-Type: application/json Connection: close Accept: application/json User-Agent: CGM-Store-1.6/19 CFNetwork/808.2.16 Darwin/16.3.0 Content-Length: 101 Accept-Language: en-us

{"password":"####","applicationId":"####","accountName":"####"}

POST /ShareWebServices/Services/Publisher/ListPublisherAccountSubscriptions?sessionId=#### HTTP/1.1 Host: share2.dexcom.com Connection: close Accept: application/json User-Agent: CGM-Store-1.6/19 CFNetwork/808.2.16 Darwin/16.3.0 Accept-Language: en-us Content-Length: 0

HTTP/1.1 200 OK Server: Microsoft-IIS/8.5 X-AspNet-Version: 4.0.30319 Cache-Control: private Content-Type: application/json; charset=utf-8 Date: Sun, 19 Feb 2017 16:34:53 GMT Connection: close Content-Length: 507

[{"ContactId":"####","ContactName":"Bobby","DateTimeCreated":{"DateTime":"\/Date(1480532932105)\/","OffsetMinutes":0},"DateTimeModified":{"DateTime":"\/Date(1480533606686)\/","OffsetMinutes":0},"DisplayName":"####","InviteExpires":{"DateTime":"\/Date(1481137732089)\/","OffsetMinutes":0},"IsEnabled":true,"IsMonitoringSessionActive":true,"Permissions":1,"State":6,"SubscriberId":"####","SubscriptionId":"####"}]

POST /ShareWebServices/Services/Publisher/ReadContact?sessionId=####&contactId=#### HTTP/1.1 Host: share2.dexcom.com Connection: close Accept: application/json User-Agent: CGM-Store-1.6/19 CFNetwork/808.2.16 Darwin/16.3.0 Accept-Language: en-us Content-Length: 0

HTTP/1.1 200 OK Server: Microsoft-IIS/8.5 X-AspNet-Version: 4.0.30319 Cache-Control: private Content-Type: application/json; charset=utf-8 Date: Sun, 19 Feb 2017 16:23:26 GMT Connection: close Content-Length: 404

{"ContactId":"####","CountryCode":"","DateTimeCreated":{"DateTime":"\/Date(1480532931964)\/","OffsetMinutes":0},"DateTimeModified":{"DateTime":"\/Date(1480532932089)\/","OffsetMinutes":0},"Email":"####","LanguageCode":"","Name":"#","PublisherAccountId":"####","State":0,"SubscriptionId":"####"}

POST /ShareWebServices/Services/General/ReadSubscriptionAlerts?sessionId=c####&subscriptionId=#### HTTP/1.1 Host: share2.dexcom.com Connection: close Accept: application/json User-Agent: CGM-Store-1.6/19 CFNetwork/808.2.16 Darwin/16.3.0 Accept-Language: en-us Content-Length: 0

HTTP/1.1 200 OK Server: Microsoft-IIS/8.5 X-AspNet-Version: 4.0.30319 Cache-Control: private Content-Type: application/json; charset=utf-8 Date: Sun, 19 Feb 2017 16:23:27 GMT Connection: close Content-Length: 753

{"FixedLowAlert":{"AlarmDelay":"PT0S","AlertId":"####","AlertType":3,"IsEnabled":false,"MaxValue":55,"MinValue":39,"RealarmDelay":"PT30M","Sound":"UrgentLow.wav"},"HighAlert":{"AlarmDelay":"PT1H","AlertId":"####","AlertType":1,"IsEnabled":false,"MaxValue":401,"MinValue":200,"RealarmDelay":"PT2H","Sound":"High.wav"},"LowAlert":{"AlarmDelay":"PT30M","AlertId":"####","AlertType":2,"IsEnabled":false,"MaxValue":70,"MinValue":39,"RealarmDelay":"PT2H","Sound":"Low.wav"},"NoDataAlert":{"AlarmDelay":"PT1H","AlertId":"####","AlertType":4,"IsEnabled":false,"MaxValue":401,"MinValue":39,"RealarmDelay":"PT0S","Sound":"NoData.wav"}}

POST /ShareWebServices/Services/Publisher/StopRemoteMonitoringSession?sessionId=#### HTTP/1.1 Host: share2.dexcom.com Connection: close Accept: application/json User-Agent: CGM-Store-1.6/19 CFNetwork/808.2.16 Darwin/16.3.0 Accept-Language: en-us Content-Length: 0

POST /ShareWebServices/Services/Publisher/ReadPublisherLatestGlucoseValues?sessionId=####&minutes=1440&maxCount=1 HTTP/1.1 Host: share2.dexcom.com Connection: close Accept: application/json User-Agent: CGM-Store-1.6/19 CFNetwork/808.2.16 Darwin/16.3.0 Accept-Language: en-us Content-Length: 0

HTTP/1.1 200 OK Server: Microsoft-IIS/8.5 X-AspNet-Version: 4.0.30319 Cache-Control: private Content-Type: application/json; charset=utf-8 Date: Sun, 19 Feb 2017 16:24:13 GMT Connection: close Content-Length: 123

[{"DT":"\/Date(1487523546000-0800)\/","ST":"\/Date(1487512746000)\/","Trend":4,"Value":104,"WT":"\/Date(1487512746000)\/"}]

POST /ShareWebServices/Services/Publisher/ReadContact?sessionId=####&contactId=#### HTTP/1.1 Host: share2.dexcom.com Connection: close Accept: application/json User-Agent: CGM-Store-1.6/19 CFNetwork/808.2.16 Darwin/16.3.0 Accept-Language: en-us Content-Length: 0

HTTP/1.1 200 OK Server: Microsoft-IIS/8.5 X-AspNet-Version: 4.0.30319 Cache-Control: private Content-Type: application/json; charset=utf-8 Date: Sun, 19 Feb 2017 16:34:54 GMT Connection: close Content-Length: 404

{"ContactId":"####","CountryCode":"","DateTimeCreated":{"DateTime":"\/Date(1480532931964)\/","OffsetMinutes":0},"DateTimeModified":{"DateTime":"\/Date(1480532932089)\/","OffsetMinutes":0},"Email":"####","LanguageCode":"","Name":"#","PublisherAccountId":"####","State":0,"SubscriptionId":"0####"}

POST /ShareWebServices/Services/General/UpdateNamedValue HTTP/1.1 Host: share2.dexcom.com Content-Type: application/json Connection: close Accept: application/json User-Agent: CGM-Store-1.6/19 CFNetwork/808.2.16 Darwin/16.3.0 Content-Length: 278 Accept-Language: en-us

{"value":"{\n \"dictionary\" : {\n \"shareToggle\" : false\n },\n \"appVersion\" : \"1.6.0\",\n \"timestamp\" : \"2017-02-19 16:23:25 +0000\"\n}","sessionId":"####","partitionId":"####","name":"shareToggle"}

POST /ShareWebServices/Services/Publisher/PostReceiverEgvRecords?sessionId=#### HTTP/1.1 Host: share2.dexcom.com Content-Type: application/json Connection: close Accept: application/json User-Agent: CGM-Store-1.6/19 CFNetwork/808.2.16 Darwin/16.3.0 Content-Length: 117 Accept-Language: en-us

{"SN":"####","Egvs":[{"ST":"\/Date(1487522346000)\/","Value":116,"DT":"\/Date(1487504346000)\/","Trend":4}],"TA":0}

POST /ShareWebServices/Services/Publisher/StartRemoteMonitoringSession?sessionId=####&serialNumber=#### HTTP/1.1 Host: share2.dexcom.com Connection: close Accept: application/json User-Agent: CGM-Store-1.6/19 CFNetwork/808.2.16 Darwin/16.3.0 Accept-Language: en-us Content-Length: 0


In [5]:
from __future__ import print_function

import json
import requests
import urllib2

method = "POST"
handler = urllib2.HTTPHandler()
opener = urllib2.build_opener(handler)
url = 'https://share1.dexcom.com/ShareWebServices/Services/General/LoginPublisherAccountByName'
url2 = 'https://share1.dexcom.com/ShareWebServices/Services/Publisher/ReadPublisherLatestGlucoseValues?sessionID='
url2a = '&minutes=1440&maxCount=1'
payload ={"password": "####", "applicationId" : "####", "accountName": "####"}
request = urllib2.Request(url, json.dumps(payload))

request.add_header("Content-Type",'application/json')
request.add_header("User-Agent",'CGM-Store-1.6/19 CFNetwork/808.2.16 Darwin/16.3.0')
request.add_header("Accept",'application/json')
request.get_method = lambda: method

try:
    connection = opener.open(request)
except urllib2.HTTPError,e:
    connection = e
if connection.code == 200:
    data = connection.read()
    data = data[1:-1]
    print('sessionID=' + data)
    url3 = url2 + data + url2a
    print(url3)
    request2 = urllib2.Request(url3)
    request2.post_method = lambda: method
    request2.add_header("Accept",'application/json')
    request2.add_header("Content-Length",'0')
    payload2 ={"":""}
    try:
        connection2 = opener.open(request2, json.dumps(payload2))
    except urllib2.HTTPError,e:
        connection2 = e
    if connection2.code == 200:
        data2 = connection2.read()
        data3 = json.loads(data2)
        if data3:
            glucose = data3[0]["Value"]
            print(data3)    
    else:
        print(connection2.code)
else:
    print(connection.code)


400

In [ ]: