http-api | The RAPyDo backend framework implementing core HTTP APIs | REST library
kandi X-RAY | http-api Summary
kandi X-RAY | http-api Summary
REST APIs integrated with the RAPyDo framework.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Create Flask app instance
- Return the frontend URL
- Return backend URL
- Log a message and exit
- Connect to Celery
- Build RabbitMQ URL
- Build redis url
- Return a list of valid credentials
- Create a response
- Validate a token
- Get all tasks in a package
- Create a user
- Create a new activation token
- Connect to Neo4j
- Launch the Flask application
- List the groups
- Get information about a user
- Connect to an SMTP instance
- Import models from package
- Set the logger
- Verify a service
- Update an activation token
- Create a new login
- Run a test suite
- Update a user
- Return the system load statistics
http-api Key Features
http-api Examples and Code Snippets
Community Discussions
Trending Discussions on http-api
QUESTION
new to the CDK and relatively new to AWS
The IssueI'm following this tutorial which includes creating a fargate based private API, and accessing it on the public internet through an ec2 instance which is publicly exposed.
I'm picking through, minimally correcting various issues which gets everything running. It comes time to build with:
...ANSWER
Answered 2021-May-25 at 15:56The timeout was due to a misnamed ECR which the bookService
was attempting to access. To generalize this answer a bit, if there's a timeout it may be good to record which resources timed out and sanity check all the constituent elements.
QUESTION
According to https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-private.html it is possible to integrate API Gateway with an internal Application Load Balancer using a private VPC link.
However I cannot make it work.
I have a service accessible internally through the ALB. The ALB has no public IP, it balances requests in a AWS Fargate cluster (all within private subnets).
...ANSWER
Answered 2021-May-06 at 07:51I got it working. It is definitely possible to use API Gateway http integrated with a private (i.e: internal facing) ALB that balances traffic in private subnets.
The problem I had is that when I created the API in API Gateway through the console, there is an option to add integration, but that integration at that point only allows HTTP or Lambda, and I don't want that, I want a private integration using a VPC link I create in advance.
So here are the steps:
- Create (if non existing already) a security group that allows HTTP traffic on 80. This group will be associated later on to VPC link
- Create VPC link associated to the VPC and, explicitly, to the private subnets where the EC2services or fargate cluster are. Make sure you select the security group that allows HTTP traffic
- Create HTTP API in Apu Gateway. On the first step give it a name but DO NOT create an integration just yet. Skip that. Skip the route creation also. Choose a stage name or leave the
$default
(I use$default
and auto-deploy). - Create a route. If you want to accept anything, do so by choosing
ANY
and the path/{proxy+}
. - Finally, on that route, attach an integration. This time you'll see that there is an option to choose a private resource where you can explicitly select the private ALB with its http listener AND the VPC link created previously.
That's it. Http requests to Api Gateway will be directed to the private internal facing ALB.
QUESTION
According to this AWS documentation page covering authorizers for AWS API Gateway it is possible to define authorizer as lambda function returning a boolean value in isAuthorized
response field to allow/deny the API request.
However after numerous attempts I can't understand how to define it in serverless.yml
(or at least in AWS console)
I'm new to AWS and serverless framework. I've decided not to dive into IAM
access policies or Cognito
just yet, thus I'm trying to build a very simple lambda authorizer function that just yields a boolean value to allow/deny API access.
I have defined my functions
section in serverless.yml
as follows:
ANSWER
Answered 2021-May-03 at 21:35There are two possible problems.
- The response is incorrect for a custom authorizer for a REST API (which is what the
http
event
is in serverless). Output from an Amazon API Gateway Lambda authorizer shows what the output should look like, as well as what is required. - You intended to use an HTTP API. In that case you should change the
event
tohttpApi
: Announcing Support for AWS HTTP APIs
QUESTION
I have an API Gateway setup using Terraform. I need to be able to visit the API Gateway on the base path, i.e, without the stage name appended to the base URL.
https://{api_id}.execute-api.{region}.amazonaws.com/
<- acceptable
https://{api_id}.execute-api.{region}.amazonaws.com/{StageName}
<- not acceptable
I would do this from the console by creating a default deployment stage like here.
I looked but could not find anything in the terraform documentation here for stages
I want to be able to do this by creating the default stage, not using a aws_api_gateway_domain_name resource
...ANSWER
Answered 2021-Apr-06 at 22:20aws_api_gateway_domain_name
is for REST API which does not have a default stage. To create such a stage you have to use HTTP API which in terraform is provided by the family of apigatewayv2 methods.
QUESTION
I'm using jsforce find-api in order to search for an account by DOB which is a field of type Date
.
The call to the API looks like this:
...ANSWER
Answered 2021-Mar-24 at 22:47The mistake was a combination of treating DateTime
as a Date
object together with lack of examples in the documentation of jsforce.
Finally I was able to figure it out:
QUESTION
I'm writing an Android app that makes frequent requests to a REST API service. This service has a hard request limit of 2 requests per second, after which it will return HTTP 503 with no other information. I'd like to be a good developer and rate limit my app to stay in compliance with the service's requirements (i.e, not retry-spamming the service until my requests succeed) but it's proving difficult to do.
I'm trying to rate limit OkHttpClient specifically, because I can cleanly slot an instance of a client into both Coil and Retrofit so that all my network requests are limited without me having to do any extra work at the callsites for either of them: I can just call enqueue()
without thinking about it. And then it's important that I be able to call cancel()
or dispose()
on the enqueue()
ed requests so that I can avoid doing unnecessary network requests when the user changes the page, for example.
I started by following an answer to this question that uses a Guava RateLimiter
inside of an OkHttp Interceptor
, and it worked perfectly! Up until I realized that I needed to be able to cancel pending requests, and you can't do that with Guava's RateLimiter
, because it blocks the current thread when it acquire()
s, which then prevents the request from being cancelled immediately.
I then tried following this suggestion, where you call Thread.interrupt()
to get the blocked interceptor to resume, but it won't work because Guava RateLimiter
s block uninterruptibly for some reason. (Note: doing tryAcquire()
instead of acquire()
and then interruptibly Thread.sleep()
ing isn't a great solution, because you can't know how long to sleep for.)
So then I started thinking about scrapping the Guava solution and implementing a custom ExecutorService that would hold the requests in a queue that would be periodically dispatched by a timer, but it seems like a lot of complicated work for something that may or may not work and I'm way off into the weeds now. Is there a better or simpler way to do what I want?
...ANSWER
Answered 2021-Mar-20 at 02:50Ultimately I decided on not configuring OkHttpClient
to be ratelimited at all. For my specific use case, 99% of my requests are through Coil, and the remaining handful are infrequent and done through Retrofit, so I decided on:
- Not using an
Interceptor
at all, instead allowing any request that goes through the client to proceed as usual. Retrofit requests are assumed to happen infrequently enough that I don't care about limiting them. - Making a class that contains a
Queue
and aTimer
that periodically pops and runs tasks. It's not smart, but it works surprisingly well enough. My Coil image requests are placed into the queue so that they'll callimageLoader.enqueue()
when they reach the front, but they can also be cleared from the queue if I need to cancel a request. - If, after all that, I somehow exceed the rate limit by mistake (technically possible, but unlikely,) I'm okay with OkHttp occasionally having to retry the request rather than worrying about never hitting the limit.
Here's the (very simple) queue I came up with:
QUESTION
I stumbled across this article and out of curiosity, I gave it try. I could successfully generate the OpenAPI spec as a JSON file from our ASP.NET Core Web API.
But when trying to create a Connected Service within Visual Studio 2019 to generate the client code from the OpenAPI spec, it fails with the following error:
...ANSWER
Answered 2021-Mar-09 at 14:35Can you try clearing the NuGet Cache? VS Tools > Options > Nuget Package Manager > General > Clear All Nuget Cache(s).
QUESTION
In my project, I have presently a legacy authentication that works in such a way:
- There is a client (standalone) that talks to an
API service
which is a custom application running in a container. - A cloud Identity provider (IdP) is used that supports OAuth with PKCE. It provides its token via usual login process when the user goes to a login page and then gets redirected to a callback.
API service
acts as a recipient for the callback. It, therefore, obtains Identity Providertoken-1
and stores it in a cache. Based on this it returns to the client a modifiedtoken-2
"computed" fromtoken-1
but different.- Once the client needs to make a REST call, it decorates it with the
token-2
JWT token. The call goes to the API service that matches it totoken-1
which can be then validated against IdP.
I have a need to get rid of the API service
with cloud-native mechanisms. I assume that AWS HTTP API gateway can be integrated with IdP directly using its JWT Authorizer capability. Regretfully I can not affect the current legacy flow that must remain functional.
However, I would like to insert a Lambda between the JWT Authorizer and client endpoints which would be doing the exchange of client-facing tokens to IdP tokens (doing what API service
was doing). Would that be possible and how I can approach this?
ANSWER
Answered 2021-Mar-08 at 08:14Sounds like you need to create a Lambda Authorizer (Formally known as Custom Authorizer) instead of using the default JWT Authorizer.
https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html
You can write your own logic in this including validating tokens and performing additional steps like you mentioned.
QUESTION
We are trying to set up a desktop application requiring a multi factor authenticated login to connect to Amazon's API gateway. To this end, we have used Amazon Cognito for the authentication with the intention of integrating it with the API gateway. Both of the Cognito and API gateway parts of the setup work independently. The issue comes with adding in the security.
By following the documentation here: https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-integrate-with-cognito.html, we have configured the API gateway to use an authorizer and a token, which is received on successful login through Cognito. When testing the the authorizer in the AWS console, the token that is received is valid and the authentication is passed.
The issue arises when trying to do this from the desktop application. After hours and hours trawling through documentation and endless googling, we're still no closer to getting it to work.
The documentation says that we have to put the token in the header of the request with the 'Authorization' key. We do this but just keep receiving a HTTP 401 (Unauthorised).
The request header being sent is as follows (the first black rectangle is the api endpoint and the second is the token we are passing in):
The same result is seen when using 3rd party apps such as postman.
From the following documentation: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-troubleshooting-jwt.html, we tried the curl command: curl -v -H "Authorization: "
but just keep getting the response:
...ANSWER
Answered 2021-Feb-18 at 10:48For anyone that comes across this in the future. The issue was nothing to do with the token being passed. Upon inspecting the token we found that the scopes didn't match up.
We'd tried to use custom scopes in Cognito, but for some reason custom scopes don't really work in desktop applications (the scope kept defaulting to aws.cognito.signin.user.admin).
Anyway, long story short. We are now using lambda authorizers to verify the ID jwt token acquired from our cognito user pool. We then allocate permissions based on the group of the user making the request.
QUESTION
I installed Hono+Ditto
using helm-charts
, as it is described in cloud2edge.
That means Hono+Ditto is running inside a minikube
on my PC.
I also created a connection, policy, and a device. So far everything works fine.
In the next step, I just wrote a simple "frond-end" to fetch the thing state from Ditto-HTTP-API. As long as I fetch the thing state manually by the mean of fetch-API everything is fine. But as soon as I try to use the SSE (Eventsource) I get the following CORS error:
...ANSWER
Answered 2021-Feb-03 at 10:28Thank you for reaching out. You found a bug which was already fixed the Ditto nginx configuration, however not yet applied to the "packages" project. I created a PR to fix this, so this should be fixed in the next Helm version of the Ditto chart: https://github.com/eclipse/packages/pull/193
This question would have been better placed on GitHub as issue - but you could of course not have known that this was a bug before.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install http-api
You can use http-api like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page