I am trying to get GIPHY Dashboard data like :
Total GIF/ stickers Upload
GIF views
When I download/Export the data , the endpoint is:
https://giphy.com/api/v2/users/aggregations/?start_dt=2013-02-01&end_dt=2020-07-08&content_type=gif,sticker
I need to get the same data via API . I also read documentation but not able to find.The documentation only has V1 api whereas above link / endpoint is V2
I am using Python.
Could anyone please help me :)
https://giphy.com/api/v2/users/aggregations/?start_dt=2013-02-01&end_dt=2020-07-08&content_type=gif,sticker&api_key={api_token}
Have you tried to reach this endpoint? Can you enter your api_token here and try it?
import requests
url = '...'
response = requests.get(url)
response.json()
Related
I'm not super familiar with APIs and have only worked with a few before where they have been quite simple to use (generate access token on website, use access token as header in get request to pull data).
I'm trying to pull data from an account on the Yahoo Japan Ads platform. Here is the documentation/tutorial I've been following: https://ads-developers.yahoo.co.jp/developercenter/en/startup-guide/api-call.html
I've tried a few different pieces of code, the link states the auth url at the top: https://biz-oauth.yahoo.co.jp/oauth
I'm not sure what parameters are required for authorisation but I've tried multiple. Here is a snippet of my code.
import requests
url = 'https://biz-oauth.yahoo.co.jp/oauth'
params = {'client_id' : '1234', 'redirect_uri' : 'oob'}
response = requests.get(url, params = params)
response.status_code
I'm unsure of what to put as the redirect uri as I plan to just pull a report from the platform, the application i have added in platform shows this in the configuration: oob
So i have used oob as the redirect uri. Using the code above, I'm getting a 404 error.
In the initial link where it shows an example, I have tried using that link instead: https://biz-oauth.yahoo.co.jp/oauth/v1/authorize?response_type=code, this also returns a 400 error.
Any help or suggestions on how to do the auth would be appreciated!
Thanks
Can someone explain how I can pull this API info with python or point me in the right direction?
On the swagger documentation page for the API I am trying to access, I go to the header authentication section; paste in the API key, and am returned with a 'Base XXXXXXXXXXXX" key. Which I learned is an encoded base64 key. Then I paste the Basic key into the API key input filed in another section (See screenshot) and am successful in pulling the API information.
However, I cannot figure out how to pull that information with python requests or postman. When I google "Pulling API with basic API key" It says I need a username and password.
Any help would be appreciated. My apologize for the noob question enter image description here
I found the answer.
from hashlib import new
from unicodedata import name
from urllib import response
import requests
import pandas as pd
url = 'URL'
headers = {'Authorization': 'Basic xxxxxxxxxxx'}
r = requests.get(url,headers=headers )
data = r.json()
I'm trying to fetch metadata from thoughtspot. I am able to call the url using browser and fetch the data. But here I'm trying to achieve it via python program. According to thougthspot documentation. I have to enable trusted authentication and pass my secret key & username to obtain a token which I can use in my program.
https://developers.thoughtspot.com/docs/?pageid=api-auth-session
my username : username#username.com
secret key : secret-key
Below is my code:(generated by postman)
import requests
url = "https://<ThoughtSpot-host>/callosum/v1/tspublic/v1/session/auth/token?auth_token=secret-key&access_level=FULL&username=username#username.com"
payload={}
headers = {}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
I'm getting Bad request error. Anyone here using thoughtspot over this issue. Appreciate your support very much.
Error I'm getting:
{"type":"Bad Request","description":"The server could not understand the request due to invalid syntax."}
I can fetch data by calling the api using a web-browser. Below url returns list of all meta-data objects. I want to achieve this using a python program (I have to authenticate first & call the below URL - Authentication step is not working for me when I tried to follow the documentation)
https://<ThoughtSpot-host>/callosum/v1/tspublic/v1/metadata/list
Did you try changing the url so that it includes the domain name?
Also post the error you are getting. And a screenshot of a working request would be great!
I want to load this api url and fetch data. I am using this code to get this but i am getting 400 bad request.
Actual website link is (https://www.lffs.eu/les-clubs/)
'''
import urllib, json
enter code hereurl = "https://gestion.lffs.eu/lms_league_ws/public/api/v1/club/byMyLeague?filter=&club_status_id=1&page=2&pagination=21"
response = urllib.urlopen(url)
data = json.loads(response.read())
print(data)
'''
There is a problem with the way you used the API. If you run it on Google you will see the error. The API expects some kind of token from you. Make sure you provide it first.
I'm trying to exchange a fb API Graph token with a long-lived one according to the explanation given in this link
Here what I do
url = "https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token&client_id={"+app_id+"}&client_secret={"+secret+"}&fb_exchange_token={"+old_token+"}"
resp = urllib.urlopen(url).read()
print resp
Here the result
{"error":{"message":"Invalid Client ID","type":"OAuthException","code":101,"fbtrace_id":"Bjvz2LDzJhs"}}
I'm using Python, I know that there is not an official SDK but I just need to crawl some post and save related data.
I don't understand what is happening, why does the client id should be not valid?
PS: the old_token works
thanks in advance!