Advice on learning email API authentication and JSON in python3 - json

Best solver or fellow problemized,
The context:
The reason I’m asking this question is that I am trying to learn how to automate clinking links in emails with python3. I’ve gone in depth on how to achieve this with selenium but without success. I’ve just heard that this could be possible with API.
I've been trying to find a documentation or explanation for the past 2 hours on how to use something like AHEM - Ad-Hoc Temporary Email Server’s API. https://www.ahem.email/help/api
An hour ago I didn’t know anything and now I know how to call json API with requests and an authentication key. yay me...
The problem:
Now I need to get an authentication token but it asks for content type string and a request body. I’m lost. I’ve used google and youtube but I can only find gmail, reddit and hackernews API documentations which are not much alike I think.
I'm sorry for the vague description of the problem that, quite honestly, resembles my knowledge about the subject. More clarity could be achieved by following the link and taking a look at General: General APIs > POST > Get access token.
The solution?
Does anyone know a good book, video or just plain advice?
Thank you so much in advance!
I hope the answer is not on the front page of Google if you get what I mean.

This should do the job.
import requests
base = 'https://www.ahem.email'
url = f'{base}/api/auth/token'
respone = requests.post(url=url)
if respone.status_code == 200:
token = respone.json()['token']
bearer = f'Bearer {token}'
header = {'Authorization': bearer }
url = f'{base}/api/alive'
print(requests.get(url=url, headers=header).json())

Related

Why I am getting insufficient scope error by posting json through postman?

I have added headers and token but still having insufficient_scope error by posting json through postman
You must share the details of request to get help. But let me also try to help you out blindly.
I had face the same issue in past and make it possible to resolve the issue by some simple attempts.
Please make sure that your token is correct, its not expired, and if your token is well authorized to make request and get access of the demanding resources from the calling API.
Also make sure that if you have need to add bearer in the start of your token.
Hope it can solve your related issue. Thank You!
Also, check your request method. (I just spent a good 30 minutes trying to figure out why I was failing.) If you have only the listings_r scope, then you can only GET. You must have listings_w to POST. (My problem was copy/pasting several lines of cURL code, and I assume someone else reading this may have done the same.)

About Twitter's REST API 1.1 Bad Authentication data Code : 215

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=20.9533951,75.9364752&radius=500&types=food&key=put_your_key_here
This is the URL of google maps api. Which returns json data if we pass the key at the last. and hit that url from our browser directly.
So is there anything like that in twitter as well? By which we can pass our consumer key or something like that at the end of link like this https://api.twitter.com/1.1/trends/available.json
Because without any tokens if we hit this URL then its giving error : Bad Authentication data Code : 215
Please help me. i am finding this from very long and have no luck.
Please Thank You So Much.
The short answer is no.
The long answer is that all requests to the Twitter REST API need to be authenticated using OAUTH. You need to follow the OAUTH process and use the tokens as described starting here.
&oauth_consumer_key= your consumer key
&oauth_nonce=nonce
&oauth_signature_method=HMACSHA1
&oauth_timestamp=1505894968
&oauth_token=token
&oauth_version=1.0
&oauth_signature=signature
You have to send these header with your request then it will work fine

Filemaker JSON httpspost

I am trying to use the plivo.com api with Filemaker to send SMS with my database.
I am using "insert from URL" to POST to the api, like below:
(ACCOUNTID, FROMNUMBER, and TONUMBER has been switched out)
httpspost://api.plivo.com/v1/Account/ACCOUNTID/Message/{"src":"FROMNUMBER", "dst":"TONUMBER", "text":"Testing text"}
The plivo site said something about using JSON for receiving, I had tested with other Filemaker solutions (FmSms) and confirm the functionality is working, so it has to be my post query is in the wrong format.
Would be great if someone of experience can give me some pointer in solving this issue.
Linkage to Plivo's documentation regarding messaging
Thanks in advance
Sunny
This will not work with FileMaker alone. The webservice accepts content-type application/json, FileMaker can send x-www-form-urlencoded only.
It may be possible to use a web viewer with some javascript to handle the request and return data back to FileMaker. See the blog post here: http://www.soliantconsulting.com/blog/2014/11/filemaker-and-javascript-ajax-post
Also, the free base elements plugin will allow you to set custom headers and should also work.

Assistance required to connect to Foursquare via TIBCO BW using REST / JSON API - 1.1

We have an assignment to check the compatibility of Quick connect project for Foursquare against the REST/JSON 1.1.
When I am testing the process, while invoking Rest API for query Check-in, the process is throwing an error – “OAuth token invalid or revoked”. Can you kindly help to fix this issue.
Access_token for this was generated by registering a sample app with Foursuare.com, having www.google.com as welcome page and redirect URL. Please let me know if this is causing the issue.
Also, let me know is there is any standard method to generate the access_token for this.
Thanks in advance.
Regards,
Shree.
It sounds like you're not following Foursquare's instructions on connecting properly, or need to reconnect to get a new access_token. Keep in mind that the access_token isn't the code that comes back in the redirect, the code needs to be used to exchange for the access_token.

Security when getting data from MySQL/PHP via JSON in XCode

I’m making a company pricelist app for the iPhone.
Most of my application is finished, except for the “security” part.
I use PHP to extract from the SQL database, and encode it as JSON.
All this is fine, except….
I would like to protect my pricelist data from others not accessing the URL request from a browser.
I’m not a great web / php programmer and I’m not sure how to implement this on the serverside.
For now I have just made a user/password in the URLRequest like
www.hopepage.com/searchDB?User=Jack&Pass=Jones&Comp=iPhone%
In the PHP I have then made something like
IF user and pass in user database then
Select * from components where comp like &Comp
However, this request shows my login in the URL string, an what is somebody sniffs this string ? I guess this is fairly easily possible ?
I have read a bit about SSL and HTTPS, but I’m not sure how to implement it on the serverside.
Anybody knows about good documentation, or can lead me in the right direction ?
Maybe a tutorial hidden somewhere on the net (I have searched, but maybe not used the correct words).
Anybody