thriftbooksapi | simple wrapper around http requests for thriftbooks.com | HTTP Client library
kandi X-RAY | thriftbooksapi Summary
kandi X-RAY | thriftbooksapi Summary
This API is a wrapper around thriftbooks.com that allows developers to programmatically read and update thriftbooks.com account infromation, place orders, and browse the avai- lable selection of books.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of thriftbooksapi
thriftbooksapi Key Features
thriftbooksapi Examples and Code Snippets
Community Discussions
Trending Discussions on HTTP Client
QUESTION
I have a standalone Blazor WASM site (client), a separate .NET 6 web API (server) with protected endpoints and I'm trying to call MS Graph from the API.
I've read just about every article I could find on the configuration required to make this work and I'm stuck with the incremental consent failing. I get the following error when trying to access a server API which uses MS Graph:
Configuration...Error acquiring a token for a downstream web API - MsalUiRequiredException message is: AADSTS65001: The user or administrator has not consented to use the application with ID '[redacted]' named '[redacted]'. Send an interactive authorization request for this user and resource.
Created AAD app for Web API (server), added secret for Graph configuration, set the app URI and created
access_as_user
scope under "Expose an API" in AAD.Added the client ID (from the following step) to the
knownClientApplications
section in the manifest for the server app registration in AAD.For API Permissions I added Graph scopes
User.Read
,User.Read.All
, andGroup.Read.All
and provided admin consent in the AAD UI.Configured
appsettings.json
in the API to add the Graph APIBaseUrl
and above scopes from step 2 along with the correct AzureAD domain,TenantId
,ClientId
, andClientSecret
values for MSAL to function.Configured MSAL on the server:
ANSWER
Answered 2022-Mar-10 at 22:30The issue here is use of the AddMicrosoftGraph
method when the API application is being built.
The GraphServiceClient
created by AddMicrosoftGraph
will have default access to delegated permissions which are assigned to users as opposed to application permissions which are assigned to applications. This is why the MsalUiRequiredException is being thrown which is usually resolved by prompting the user to login.
You can read more about delegated vs application permissions here.
What you can do instead is use the AddMicrosoftGraphAppOnly
method to create a GraphServiceClient
that will use credentials specific to your API to retrieve the relevant data needed from the Microsoft Graph API.
QUESTION
I am using PouchDB and CouchDB in an ionic application. While I can successfully sync local and remote databases on Chrome and Android, I get unauthorized error on Safari / iOS when I run the sync command. Below is a simplified version of my database service provider.
...ANSWER
Answered 2022-Jan-11 at 00:41Changing the HTTP plumbing sounds like a really bad idea - time cost, mainly - unless you just absolutely have to use sessions/cookies...If you don't, read on.
as noted here regarding pouchDB Security, I tried using pouchdb-authentication when it was actively maintained and went another route due to multiple issues (I don't recall specifics, it was 6 years ago).
Do note the last commit to pouchdb-authentication seems to be 3 years ago. Although inactivity is not an negative indicator on the surface - a project may have simply reached a solid conclusion - installing pouchdb-authentication yields this
QUESTION
I've got an AWS Object Lambda Access Point. (These are sort of like a proxy lambda function which can intercept S3 requests and transform them.) It runs fine when not run inside a VPC (so I think IAM is fine). A later iteration will want to access private resources so I want it running inside a VPC.
The flow of one of these lambdas (at least when transforming a GET request) is:
- Get invoked
- Download the object that was requested using a HTTP client (you get a pre-signed URL to grant access (
getObjectContext.inputS3Url
in the payload)) - Do your transformation
- Write the result using
s3.Client.WriteGetObjectResponse
It's the last step that isn't working for me.
In my VPC I've added a gateway endpoint for S3 (for S3 either gateway or interface endpoints are supported; gateways are free. This works fine to fetch the object (step 2), I can download the object and work on it. I think that download happens through the gateway endpoint. So far so good.
But after doing the processing it times out when trying to write the response (step 4). In the logs it looks like this:
...ANSWER
Answered 2022-Jan-13 at 13:39The short answer is: You can run your object lambda function in a VPC as long as you allow it to route to s3-object-lambda..amazonaws.com through the internet, e.g. through a NAT gateway. You were on the right track and basically figured it out in your question already.
The S3 gateway interface endpoint is necessary to enable download of the input object.
When writing the result, the request goes to s3-object-lambda
, which is technically a different service than S3 (at least on network level). AWS currently doesn't provide an interface endpoint for s3-object-lambda and the S3 gateway endpoint doesn't cover it either (which can be verified by comparing the IP address WriteGetObjectResponse
request goes to and the routes created by the gateway endpoint).
So the only way is to route WriteGetObjectResponse
requests via opened access to the internet. For future reference, one way to set this up is with a NAT gateway. Quoting AWS docs:
- The NAT gateway must be in a public subnet with a route table that routes internet traffic to an internet gateway.
- Your instance must be in a private subnet with a route table that routes internet traffic to the NAT gateway.
- Check that there are no other route table entries that route all or part of the internet traffic to another device instead of the NAT gateway.
In other words:
- Provision a public NAT Gateway in a public subnet and allocate it an elastic IP
- Make sure the public subnet has an internet gateway and the default route (
0.0.0.0/0
) points to it. - Set up a default route (
0.0.0.0/0
) from the subnet hosting your lambda and point it to the NAT Gateway.
You're right that a NAT Gateway is priced by the hour, unfortunately, and you need one per subnet.
In theory, you could at least limit the egress with a security group to IP addresses of the s3-object-lambda
service, but I'm not aware these IP ranges are published anywhere.
QUESTION
Upon making a call from a Java project to a Python rest API, I am met with an error that states "Unsupported upgrade request."
I'm making a simple GET request from Java, to the endpoint written in Python, and at some point Java decides it wants to request to upgrade the connection to a websocket. My issue is, I never reference websockets in my Java project whatsoever, and when I debug and look at the value of headers in the request, it does not show any headers at all, but at some point before it hits the network it decides it wants to do an upgrade request. I haven't sniffed my own traffic to confirm the existence of the header yet; but the problem does not exist when I use OKHTTP instead of java.net.http.HttpClient
This code results in the Unsupported Upgrade Request error returned by the Python API.
...ANSWER
Answered 2022-Jan-12 at 11:05Requests shouldn't be upgraded to websocket - but the default for the HttpClient is to request an upgrade to HTTP/2.
If you don't want the HttpClient to request an upgrade to HTTP/2 you can set the version in the request to Version.HTTP_1_1
, or set the default version in the HttpClient to Version.HTTP_1_1
.
See: HttpRequest.Builder::version or HttpClient.Builder::version
QUESTION
I have a nested logic app which takes some time for 4 retries in case of a failure. According to the documentation, the default HTTP timeout is 100 seconds. I'm able to increase the HTTP client timeout value in my code which triggers the parent logic app, but in case of a failure in the child logic app, it is retried 4 times and takes much longer. Meanwhile, the parent logic app responds with a 504 (gateway timeout). There are some more actions to take care of after the child logic app returns a response, so I can't make it asynchronous and return 202 to the code trigger. Is there a way to increase the timeout in the nested logic app without making it async?
E.g. - My nested logic app retried 4 times and failed after 4 minutes
However, my code already receives a response of 504 after 2 minutes 9 seconds of triggering the parent logic app
The HTTP client which triggers the parent logic app has a timeout of 20 minutes. I verified that this timeout value is working, because without it, we were receiving the timeout reponse in 1 minute 40 seconds (100 seconds), which is default HTTP trigger timeout. I'm under the impression that if the nested logic app also doesn't respond within 100 seconds of being triggered, the parent throws a timeout because it didn't receive a response. Is there a way to work around this?
...ANSWER
Answered 2021-Sep-16 at 12:03It might not be possible without asynchronous patterns or async calls but One of the workarounds can be using HTTP+Webhooks where you can set the timeout value.
You can research this more from HERE.
QUESTION
I'm attempting to set up our Blazor Server application to use a custom delegating handler that will attach a bearer token to all outgoing requests to our APIs. The delegating handler uses a token service that handles the retrieval of the token as well as the process for refreshing it if it's expired. The code looks like this:
...ANSWER
Answered 2021-Nov-03 at 00:57As per the comment, there is an excellent blog post by Andrew Lock that talks about this.
TL;DR
You'll need to use IHttpContextAccessor
to resolve the scoped service and get the instance you want.
Example
All credit for this example should be given to Andrew Lock and his blog post, but for quick reference readers of this question, you need to inject the IHttpContextAccessor
into your DelegatingHandler
and use that to access the correct scoped service.
QUESTION
On my local machine, I want to use cURL as an HTTP client like so:
...ANSWER
Answered 2021-Nov-18 at 08:42From the PHP website:
php://input
is a read-only stream that allows you to read raw data from the request body.php://input
is not available withenctype="multipart/form-data"
.
So if you specify the Content-Type
as application/json
using -H "Content-Type: application/json"
you ought to get it in the input stream
complete example:
QUESTION
I am building a simple REST API package using cURL and would like to catch an error and then return a view. I am able to throw an error if I dd($e) but if I try and return a view it just continues with the code after the catch function. Shouldn't PHP kill the process and just go to the login view?
...ANSWER
Answered 2021-Oct-23 at 09:47Could you try this please?
QUESTION
EDIT I'm able to build my OkHttp client to where it includes both the client cert in the Client.SSLContext.KeyManager, and the trusted certs in the Client.SSLContext.TrustManager
...ANSWER
Answered 2021-Oct-19 at 08:20Okay; it has developed your problem is that when the server requests your client-cert/auth, it specifies a CA list that doesn't include the CA(s?) used by your cert-and-chain, even though when presented with your cert-and-chain the server accepts it. After commenting about writing a wrapper KeyManager, I realized it would be easy enough to test, and the following example works for me to send a client cert different from what the server asked for. I used SSLSocket directly for simplicity, but anything (like OkHttp) using the same SSLContext or SSLSocketFactory should work. Tested in 8u301 (but I can check some others if you want) against OpenSSL commandline, which lets me request client cert for CA X but when I submit a cert from CA Y it only logs the verification error without aborting the connection.
QUESTION
I am working on a project and I am trying to utilize the concepts of Domain Driven Design.
I have the following domain model: (it is simplified for this question)
Let me explain the system first.
This system is for monitoring data coming from gateways. In this case there are two gateways, but there might be more in reality. Each gateway has its own implementation, so its own entities.
An example of the system is as follows:
A company has a project to monitor ship data.
So they have two gateways. A gateway with type
Field-Device-Gateway and a gateway with type
HTTP-Client-Gateway.
The first gateway (field-device-gateway) can have multiple field devices. A field device is a small device onboard on a ship. This device receives all data coming from devices on board of the ship. This is through a source (like an address) that has to be setup in the system.
The second gateway (http-client-gateway) can have multiple HTTP clients. Each client may have multiple routes.
So, a gateway also has variables. A variable is a configuration for getting a specific set of data. So, on the field-device-gateway might be a variable specifying to get integer data from a specific device
, from a specific field device source
, from a specific field device
.
The system will make a request to the field device with the new variables. The field device then knows what data to send. It will be received by the system and stored in the database.
So, what am I asking?
Currently, everything is coupled. I need to define boundaries and then aggregates, but I just don't know where to start.
If I would not create boundaries, this will just become an enormous coupled mess and makes it hard to make aggregates.
So, what would the boundaries be? And what about the aggregates, are there even aggregates? Is everything its own aggregate?
And if everything is its own aggregate, how do I enforce some business logic like: A variable can only exist if there is a gateway, project and company.
...ANSWER
Answered 2021-Oct-06 at 07:49Before thinking about boundaries, you have to go back to domains and subdomains.
The problem space is your domains (and subdomains) and your solution space is your Bounded Contexts
.
The first important issue in the application of the DDD in a project is to identify your sub-domains and in particular to divide them into the 3 following "families":
- Core Domain
- Supporting Subdomain
- Generic Subdomain
This cutting is driven by this sub-domain families and by the domain expert.
A Bounded Context
is a language boundary where context is king. We only know the meaning of a concept thanks to its context (which is also a cultural context).
How to avoid making mistakes in the division of Bounded Contexts
?
- When there are technical or architectural considerations
- When you try to split a
Bounded Context
to distribute tasks to free developers - If you have two objects that don't have the same definitions, then they must be in two different
Bounded Contexts
If you think to all this, you may easily separate your objects (your language) into these Bounded Contexts
.
For your Aggregate
's problem :
- Try to decide for each class if it is an
Entity
or aValue Object
(orDomain Service
but try to avoid). - Your
Aggregates
are "some" of your main Entities which can drive otherEntities
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install thriftbooksapi
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