'How To Send Post Request With application/grpc In Python
I have tried many times to send this requests but I can't
First I got the http request for app called "NOWAPP" By "http canary app on android" And the request post link is : "https://firestore.googleapis.com/google.firestore.v1.Firestore/Write"
"""
POST /google.firestore.v1.Firestore/Write h2
Host: firestore.googleapis.com
user-agent: grpc-java-okhttp/1.44.1
content-type: application/grpc
te: trailers
x-goog-api-client: gl-java/ fire/24.0.2 grpc/
google-cloud-resource-prefix: projects/nowapp-343220/databases/(default)
x-goog-request-params: projects/nowapp-343220/databases/(default)
x-firebase-client: android-target-sdk/31 flutter-fire-auth/3.3.9 kotlin/1.6.10 fire-transport/18.1.1 flutter-fire-fst/3.1.10 android-installer/ fire-core/20.1.0 android-min-sdk/ device-model/grandprimeve3g fire-auth/21.0.2 fire-fcm/23.0.1 flutter-fire-gcs/10.2.9 device-brand/samsung fire-android/22 device-name/grandprimeve3gxx fire-fst/24.0.2 fire-installations/17.0.1 flutter-fire-core/1.13.1 fire-analytics/20.1.0 android-platform/ flutter-fire-fcm/11.2.11 fire-gcs/20.0.1
x-firebase-gmpid: 1:74027842950:android:009cb66648d561e1d14007
grpc-accept-encoding: gzip
authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6ImFhZmE4MTJiMTY5NzkxODBmYzc4MjA5ZWE3Y2NhYjkxZTY4NDM2NTkiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20vbm93YXBwLTM0MzIyMCIsImF1ZCI6Im5vd2FwcC0zNDMyMjAiLCJhdXRoX3RpbWUiOjE2NTAxNTIzNjgsInVzZXJfaWQiOiJVajhHdm55bkxpVjd6NDJ0MnpkWDV3dkhvalAyIiwic3ViIjoiVWo4R3ZueW5MaVY3ejQydDJ6ZFg1d3ZIb2pQMiIsImlhdCI6MTY1MDM2MzUxNiwiZXhwIjoxNjUwMzY3MTE2LCJlbWFpbCI6Im1la2hhYmVraGE2MDVAZ21haWwuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsImZpcmViYXNlIjp7ImlkZW50aXRpZXMiOnsiZW1haWwiOlsibWVraGFiZWtoYTYwNUBnbWFpbC5jb20iXX0sInNpZ25faW5fcHJvdmlkZXIiOiJwYXNzd29yZCJ9fQ.KDnRmUwzdiKR96-TWqi_m7504jbjiELQyGng0lJ6v3eAF_hpVyox1PslPnLpPpmOz3qq4mj61IYFIAeOyALHBtoehJ3c_OKZ4RyjAwbH4aIgC8xbnVgFkOEX7-p0kC2dA5kymIHHw4WJcvrph215BD7mXlHTdZUvv-SWeN2mez5CL3pfA8L1y8rD4rJ4qz9ZymLppiROpMG5J7_eGaSY1h7UIdz762_zK7fQwD-OxdDcaewgyfFDvESPFDz_-nfF-yw2NzAn0Vgr6PKukwnd-tdZu8kf0b9wnsyjZcIRKp-gM0tVu-DQB8gVrEQtac8x_6mRdPAPgLUGSSNb4UI3dQ
,
*projects/nowapp-343220/databases/(default)��
�
�projects/nowapp-343220/databases/(default)/documents/posts/9cca1ee0-bf55-11ec-b4b7-3b761ad93693/likes/Uj8GvnynLiV7z42t2zdX5wvHojP2)
userId�Uj8GvnynLiV7z42t2zdX5wvHojP2" hB����"""
This is the all payload. So how can I send post request with this payload I have tried this code but it doesn't work
import requests
with open('request.json', 'rb') as f:
json = f.read()
with open('request.hcy', 'rb') as f:
data = f.read()
s = requests.session()
r = s.post('https://firestore.googleapis.com/google.firestore.v1.Firestore/Write', json=json, data=data)
print(r.content)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

