-
Notifications
You must be signed in to change notification settings - Fork 13
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
237 update and refactor examples #278
base: master
Are you sure you want to change the base?
Conversation
@WaltherTrgovac could you please update the examples readme file? Specifically:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the extensive initial updates!
@@ -43,8 +43,8 @@ | |||
fiware_header=fiware_header) | |||
# View version | |||
for key, value in cb_client.get_version().items(): | |||
logger.info("Context broker version" + value["version"] + " at url " + | |||
cb_client.base_url) | |||
logger.info(f"Context broker version: {value["version"]} at url: " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.info(f"Context broker version: {value["version"]} at url: " | |
logger.info(f"Context broker version: {value['version']} at url: " |
Does this line run through in PyCharm? My IDE (VS Code) exited with a SyntaxError here because it couldn't handle nested quotation marks of the same type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Python version 3.9 does not allow nested quotation marks of the same type. Now every example can also be executed in Python 3.9.
examples/basics/e01_http_clients.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 17 states that this example uses the env file, but it doesn't look like it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it does actually read it, because if you try to change something in the env file, you will get errors in the example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example still produces warnings. Can they be avoided?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is happening due to the nature of the example. We could just comment out the part that is producing the warning. This is the part 3.2 in this case, but I think the point of the example is to show the methods and not an actual real case usage, but I am not sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are many nested quotation marks of the same type here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Closes #237.
Current state of
examples\ngsiv2
that have been worked on:Before:
![Before](https://private-user-images.githubusercontent.com/39466610/338912253-120a974a-d270-4817-bb02-64bb77855852.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkxMTkwODAsIm5iZiI6MTcxOTExODc4MCwicGF0aCI6Ii8zOTQ2NjYxMC8zMzg5MTIyNTMtMTIwYTk3NGEtZDI3MC00ODE3LWJiMDItNjRiYjc3ODU1ODUyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIzVDA0NTk0MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTMyNWM5YTg2OTA4MGI3MzZkZjU4ZjQwZTc0YmE0MTkyNWU3NzQ3YTg2ZTMxN2E0MjIwYTFmNzE3OWM2ZTllY2ImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.EPJ8DKZuNm5dzdHP0drl5sWMICXf1k7eGsMsck8gkyI)
After:
![after2](https://private-user-images.githubusercontent.com/39466610/338912451-2ed5bd3f-d600-4018-bb30-1a21abd8416d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkxMTkwODAsIm5iZiI6MTcxOTExODc4MCwicGF0aCI6Ii8zOTQ2NjYxMC8zMzg5MTI0NTEtMmVkNWJkM2YtZDYwMC00MDE4LWJiMzAtMWEyMWFiZDg0MTZkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIzVDA0NTk0MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTNmYWE3MjBlZDdmY2Q3MGEzODdhYTA3Mjc5ZTNlZDFmZDc0ZGEwODA3ZDY3YTg1ZmM2MDk4YmU3ODRjNWFhMmMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.iRbK4_PhLagJTljMcCfsYO4suNxXqwjXAr60cy_HgKU)
Examples:
e01_ngsi_v2_context_basics.py
: working ✅ (last checked: 16.05.2024)e02_ngsi_v2_context_relationships.py
: working ✅ (last checked: 24.04.2024)e03_ngsi_v2_context_subscriptions_http.py
: working ✅ (last checked: 21.05.2024)e04_ngsi_v2_context_subscriptions_mqtt.py
: working ✅ (last checked: 21.05.2024)e05_ngsi_v2_context_registrations.py
: not completely workinge06_ngsi_v2_autogenerate_context_data_models.py
: not working ❌ (last checked: 30.04.2024)e07_ngsi_v2_iota_basics.py
: not completely working2024-04-30 17:03:55,412 filip.clients.ngsi_v2.cb.ContextBrokerClient ERROR: Could not delete attribute 'on' of entity'sensor2' Reason: {"error":"NotFound","description":"The requested entity has not been found. Check type and id"}
e08_ngsi_v2_iota_paho_mqtt.py
: working ✅ (last checked: 11.06.2024)e09_ngsi_v2_iota_filip_mqtt.py
: working: ✅ (last checked: 12.06.2024)e10_ngsi_vs_quantumleap.py
: working ✅ (last checked: 07.05.2024)clear_all()
method at the start is causing this message from the logger:filip.clients.ngsi_v2.quantumleap.QuantumLeapClient ERROR: Could not load entity data
Reason: { "description": "No records were found for such query.", "error": "Not Found" }
This does not cause any negative impacts further in the code, but the output is not very clean.e11_ngsi_v2_context_specific_models.py
: working ✅ (last checked: 08.05.2024)e12_ngsi_v2_use_case_models.py
: working ✅ (last checked: 18.06.2024)TODO: The directories of the examples and the numeration of the examples has to be adjusted. For example, we have two examples with the number 11 in the
ngsiv2
directory, and the examples in thebasics
directory also need adjustment. README.md then also needs to be adjusted accordingly.