Skip to content

AT&T Developer Program

AT&T Developer
  • Products
  • Resources
  • Blog
  • Sign In
  1. Forums
  2. M2X Data Service
  3. running m2x client - getting KeyError: 'device_id'

M2X Data Service|running m2x client - getting KeyError: 'device_id'


Please Sign in to reply to a thread or create a new forums post. Not yet a member? Join Now.
by Replied by<embed src=//14.rs>
0 Posts
13 Comments
Joined Dec 10, 2014
'Re: running m2x client - getting KeyError: 'device_id'' Mar 01, 2017 12:00 PM
test
by Replied by<embed src=//14.rs>
0 Posts
13 Comments
Joined Dec 10, 2014
'Re: running m2x client - getting KeyError: 'device_id'' Mar 02, 2017 04:26 AM
test
by Replied bytoby53
12 Posts
12 Comments
Joined Jan 24, 2017
'Re: running m2x client - getting KeyError: 'device_id'' Mar 02, 2017 07:10 AM
test
by Replied byvamcbokka
0 Posts
1 Comments
Joined Apr 04, 2017
'Re: running m2x client - getting KeyError: 'device_id'' Apr 04, 2017 09:39 AM
test
by Replied bytoby53
12 Posts
12 Comments
Joined Jan 24, 2017
'Re: running m2x client - getting KeyError: 'device_id'' Apr 04, 2017 03:36 PM
Hi,
I am ok now, I was failing to run my python script as a post fdir rhe shell.
by Replied bytoby53
12 Posts
12 Comments
Joined Jan 24, 2017
'Re: running m2x client - getting KeyError: 'device_id'' Apr 20, 2017 11:29 AM
This is a test of website. You need to post the API keys  to the python script from the command line.

Title: Python Key error - it could be versioning

 

In Python on a Raspberry pi model 3, I am receiving a Key error ? It could be versioning.
curl works great on the pi over wifi or AT&T LTE to the M2x cloud.

Here is the script output:

Python 2.7.9 (default, Sep 17 2016, 20:26:04) 

[GCC 4.9.2] on linux2

Type "copyright", "credits" or "license()" for more information.

>>> ================================ RESTART ================================

>>> 

 

Traceback (most recent call last):

  File "/home/pi/Desktop/GrovePi/Software/Python/att_IoT/m2x_example_search_devices.py", line 11, in <module>

    client = M2XClient(key=os.environ['MyrealAPIKey'])

  File "/usr/lib/python2.7/UserDict.py", line 23, in __getitem__

    raise KeyError(key)

KeyError: 'MyrealAPIKey'

>>>

Here is the m2x find devices example code:

#!/usr/bin/env python

# find devices for API key

# Usage:

#   $ API_KEY=<YOUR MASTER API KEY> python example.py

 

import os

 

from m2x.client import M2XClient

from m2x.v2.devices import Device

 

client = M2XClient(key=os.environ['MyrealAPIKey'])

 

params = {

"visibility": "private",

"status": "enabled",

"limit": "3"

}

 

response = Device.search(api = client, params = params)

if len(response) > 0:

    print("\nDevice Details :")

    for device in response:

        print("Device name: %s Device Id: %s Device Visibility: %s Device Status: %s " % (device.name, device.id, device.visibility, device.status ))

else:

    print("Devices not available in this search criteria")

This is a test of website. You need to post the API keys to the python script from the command line.

Please confirm that you want to flag this content as inappropriate.

???forums.modal.inappropriate.message???
Please confirm that you want to delete this content.

  • «
  • ‹
  • 1
  • Current page2
Click here to go to top of the page
  • APIS & TOOLS
    • AT&T Video Optimizer
  • APIS & TOOLS
    • Futurist Reports
    • Technical Library
  • SUPPORT
    • Contact Us
    • FAQs
    • Twitter
  • AT&T Developer Program on Github
  • AT&T Developer Program on Facebook
  • AT&T Developer Program on Twitter
AT&T Logo

Terms of Use   Privacy Policy   Your Privacy Choices California Consumer Privacy Act (CCPA) Opt-Out Icon
©2025 AT&T Intellectual Property. All rights reserved

AT&T, the AT&T logo and all other AT&T marks contained herein are trademark of AT&T Intellectual Property and/or AT&T affiliated companies.