https://github.com/mireklzicar/eigerrequests
A repository implementing example Python http requests for DECTRIS EIGER DETECTOR.
https://github.com/mireklzicar/eigerrequests
dectris eiger python requests simplon
Last synced: 29 days ago
JSON representation
A repository implementing example Python http requests for DECTRIS EIGER DETECTOR.
- Host: GitHub
- URL: https://github.com/mireklzicar/eigerrequests
- Owner: mireklzicar
- Created: 2022-08-23T11:52:15.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-08-30T11:34:05.000Z (almost 4 years ago)
- Last Synced: 2025-08-08T16:38:46.929Z (10 months ago)
- Topics: dectris, eiger, python, requests, simplon
- Language: Jupyter Notebook
- Homepage:
- Size: 376 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Eiger Requests
A repository implementing example Python http requests for DECTRIS EIGER DETECTOR. Based on SIMPLON API reference (see the pdf file attached in this repo). The working Python 3 examples are in requests.ipynb. This repository is not official.
## SIMPLON Example
- see page 16 of the reference
- the following example is in Python 2
```python
import json
# Imports "JSON" library
import requests
# Imports "requests" library
dict_data = {'value':8040.0}
# Prepare the dictionary (a "value" with the value 8040.0)
data_json = json.dumps(dict_data)
# Convert the dictionary to JSON
r = requests.put('http:///detector/api//config/photon_energy', data
=data_json)
# Execute the request on the config value "photon_energy" (REPLACE and <
VERSION> with the values of YOUR system)
print r.status_code
# Print the http status code (NOTE: Only http code 200 is OK, everything else is an error)
print r.json()
# Print the returned JSON string. (Containing the names of the subsequently changed values)
```