从身体的Visual Basic中获取请求请求Restfulapi
因此,下面是我的RESTFUL API上的代码。它在Postman中工作完全很好。
我想用包含{“ email_address”的主体向API发送请求“> [email  prected] ”}
,但无法弄清楚如何在Visual Basic中做到这一点。任何帮助将不胜感激。
import boto3
import json
users = ["[email protected]", "[email protected]"]
def respond(res):
return {
'statusCode': 200,
'body': json.dumps(res),
'headers': {
'Content-Type': 'application/json'
}
}
def lambda_handler(event, context):
body = event['body']
email_address = json.loads(body)['email_address']
if email_address in users:
response = "Authorised"
return respond(response)
else:
response = "NotAuthorised"
return respond(response)
它正在使用以下代码在Python中工作:
import requests
x = requests.request(method='get', url='APIURL', data='{"email_address":"[email protected]"}')
x.json()
猜猜我只需要一些帮助将其转换为Visual Basic即可。
SO, below is the code on my Restful API. It is working in Postman completely fine.
I am wanting to send a request to the API with the body containing {"email_address":"[email protected]"}
but can't figure out how to do that in Visual Basic. Any help would be appreciated.
import boto3
import json
users = ["[email protected]", "[email protected]"]
def respond(res):
return {
'statusCode': 200,
'body': json.dumps(res),
'headers': {
'Content-Type': 'application/json'
}
}
def lambda_handler(event, context):
body = event['body']
email_address = json.loads(body)['email_address']
if email_address in users:
response = "Authorised"
return respond(response)
else:
response = "NotAuthorised"
return respond(response)
It is working in Python with the below code:
import requests
x = requests.request(method='get', url='APIURL', data='{"email_address":"[email protected]"}')
x.json()
Guess I just need some help converting it to Visual Basic.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论