Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fcannizzaro/esp8266-request
Make simple http requests on esp8266 Micropython
https://github.com/fcannizzaro/esp8266-request
esp8266 http micropython request
Last synced: 17 days ago
JSON representation
Make simple http requests on esp8266 Micropython
- Host: GitHub
- URL: https://github.com/fcannizzaro/esp8266-request
- Owner: fcannizzaro
- License: mit
- Created: 2017-03-05T22:13:55.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-09T21:53:49.000Z (almost 8 years ago)
- Last Synced: 2024-11-10T12:47:37.739Z (2 months ago)
- Topics: esp8266, http, micropython, request
- Language: Python
- Size: 8.79 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# esp8266-request
Make simple http requests on esp8266 Micropython# Usage
```python
from request import Requestheads = { 'Authorization': 'Basic QWxhZGRpbjpPcGVuU2VzYW1l' }
# Get Request
err, response = Request.get('httpbin.org/get', heads)# JSON response
if not err and response.statusCode is 200:
print(response.body)# Post Request (JSON Data)
data = {
'arg' : [1,2,3],
'nested' : {
'inside' : 7
}
}# Response Body as file
err, _ = Request.post('httpbin.org/post', data, file='response.txt')
```# Valid URL
- http://example.com
- www.example.com
- example.com
- example.com:8080
- example.com/path/to
- 93.184.216.34# Request
Use python dictionaries for headers and post data.# Response (Class)
## statusCode
request status code 200, 404, ...## headers
python dictionary## body
response body (text or dictionary)