-
Notifications
You must be signed in to change notification settings - Fork 0
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
I can read but not create #1
Comments
Could you give me your code of the send_request function?Envoyé depuis mon appareil Galaxy
-------- Message d'origine --------De : rhylkiio ***@***.***> Date : 22/06/2023 11:08 (GMT+01:00) À : WoolDoughnut310/micropython-firebase-auth ***@***.***> Cc : JMFUZ ***@***.***>, Author ***@***.***> Objet : Re: [WoolDoughnut310/micropython-firebase-auth] I can read but not create (Issue #1)
Hello, I am facing the same problem here except I can't read or write. Were you able to find a way around it
Traceback (most recent call last):
File "", line 57, in
File "", line 37, in connect_to_wifi
File "", line 18, in connect_to_firebase
File "/lib/ufirestore/ufirestore.py", line 229, in get
File "/lib/ufirestore/ufirestore.py", line 104, in get
File "/lib/ufirestore/ufirestore.py", line 51, in send_request
TypeError: unexpected keyword argument 'params'
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Hello, I found my problem wasn't with this firebase-auth library but with micropython-firebase-firestore. I posted in the wrong forum.
|
Hello, I found the problem, to solve Modify your json.py def process function by commenting out the name. Here is the updated code :
|
Hi,
I'm trying this library and fth firebase-firestore one.
I can connect to my database because I can read
But I can't write in it and I've no error message, then I can't know why
Firestore rules :
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /users/{user} {
allow read, write: if request.auth != null;
}
}
}
My code :
import os
import network
import time
import ujson, urequests, _thread
SSID = "SSID"
password = "password"
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
if not wlan.isconnected():
wlan.connect(SSID, password)
print("Attente de la connexion WIFI", end="...")
while not wlan.isconnected():
print(".", end="")
time.sleep(1)
print()
print("Reseau WIFI", SSID , "connecté :", wlan.ifconfig()[0])
import ufirestore as firestore
from json import FirebaseJson
from firebase_auth import FirebaseAuth
from firebase_auth import AuthSession
firestore.set_project_id("firestore-db-test1")
auth = FirebaseAuth("API_KEY")
auth.sign_in("[email protected]", "AAAAAAA")
firestore.set_access_token(auth.session.access_token)
print("===== Lecture =====")
print("")
raw_doc = firestore.get("users/")
print("raw_doc : ", raw_doc)
print("")
print("===== Ecriture =====")
print("")
doc = FirebaseJson()
doc.set("Name/stringValue", "John Doe")
doc.set("Age/integerValue", 25)
response = firestore.create("users/", doc, bg=False)
print(response)
auth.sign_out()
The results :
===== Lecture =====
raw_doc : {'documents': [{'fields': {'Age': {'stringValue': '21'}, 'Name': {'stringValue': 'Jane Doe'}}, 'createTime': '2022-10-31T12:32:34.756017Z', 'name': 'projects/firestore-db-test1/databases/(default)/documents/users/FhjDBdURqcaQlpwdXlFG', 'updateTime': '2022-10-31T12:32:34.756017Z'}]}
===== Ecriture =====
Traceback (most recent call last):
File "", line 92, in
File "ufirestore.py", line 222, in create
File "ufirestore.py", line 90, in create
File "ufirestore.py", line 53, in send_request
File "urequests.py", line 104, in request
AssertionError:
I need help because I really don't know I happened
Thanks in advance
The text was updated successfully, but these errors were encountered: