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

add extracted device id to kafka raw data topic #17

Merged
merged 2 commits into from
Oct 17, 2023

Conversation

sheenacodes
Copy link
Contributor

added already extracted device id to kafka raw data. this avoids extracting again from request params/body on parser.app

@sheenacodes sheenacodes requested a review from aapris October 11, 2023 08:31
Copy link
Contributor

@aapris aapris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

device_id is a good catch, but fix httpx.post call and then merge.

@@ -94,7 +94,7 @@ def test_digita_endppoint_authenticated_access():
# Replace Time with ~current time
ts = (datetime.now(timezone.utc) - timedelta(seconds=1)).strftime("%Y-%m-%dT%H:%M:%S.%f%z")
payload["DevEUI_uplink"]["Time"] = ts
resp = httpx.post(url, headers=headers, params=params, data=payload)
resp = httpx.post(url, headers=headers, params=params, data=json.dumps(payload))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to use json=payload when httpx.post()ing, e.g.

resp = httpx.post(url, headers=headers, params=params, json=payload)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On my machine dev set up, resp = httpx.post(url, headers=headers, params=params, json=payload) makes the parser error out at json.loads(data["request"]["body"].decode()) because the body comes as url encoded. b'DevEUI_uplink=%7B%27Time%27%3A+%272023-10-17T08%3A32%3A1 ..
data=json.dumps(payload) fixes this issue. Do parser work with just 'payload' for you ? @aapris

@sheenacodes sheenacodes force-pushed the feature/add-device-id-to-kafka-raw-data branch from e2e9c12 to 5693562 Compare October 17, 2023 09:12
@sheenacodes sheenacodes merged commit 1fe8d90 into main Oct 17, 2023
0 of 2 checks passed
@sheenacodes sheenacodes deleted the feature/add-device-id-to-kafka-raw-data branch October 17, 2023 09:14
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

Successfully merging this pull request may close these issues.

2 participants