I am new to Python and APIs and I am trying to get some data from the API. More specifically I am trying to get some tables from a base. I am following this GitHub repository's instructions:
https://github.com/bayesimpact/airtable-python
So far I have created a virtual environment called mypyth and in there I have initiated a script called get_data.py
This is what my script looks like (I have written API KEY instead of my real api key:
import requests
from airtable import airtable
at = airtable.Airtable('appa3r2UUo4JxpjSv', 'API KEY')
at.get('Campaigns')
Now these are the commands I run on the console:
(mypyth) PS C:\Users\andri\PythonProjects\mypyth> py do_get_account.py
Traceback (most recent call last):
File "do_get_account.py", line 2, in <module>
from airtable import airtable
ModuleNotFoundError: No module named 'airtable'
(mypyth) PS C:\Users\andri\PythonProjects\mypyth>
Does anyone understand why I get this error? Perhaps there is a step I havent followed? Thanks in advace for any answer
Related
I have this app that I've built, which scrapes recipes and adds them to evernote. Link here. In the EvernotePy folder, there is a python3 script called Add_to_Evernote.py that interfaces with the API. When I have Sandbox = True, then it works like normal, but when I turn Sandbox = False it breaks when trying to call the function client.get_authorize_url(). I just received an email today saying that my API-Key got activated for their production servers, so Idk what' wrong.
The error I'm getting is:
Traceback (most recent call last):
File "./EvernotePy/Add_to_evernote.py", line 69, in <module>
webbrowser.open(client.get_authorize_url(request_token))
File "/usr/local/lib/python3.8/dist-packages/evernote3-1.25.0-
py3.8.egg/evernote/api/client.py", line 58, in get_authorize_url KeyError: 'oauth_token'
What do I have to do?
This happened to me too,happened it was because though I changed the sandbox to FALSE I didn't redeploy the app. so make sure after changing the sandbox value the app is redeploy so the changes takes effect
I'm trying to play with sandbox on athenahealth - https://docs.athenahealth.com/api/guides/explore-and-prototype - After registering and creating an application, I begin using sandbox - try sandbox. I scroll to the sample code, go to GH >> samplecode >> python3 >> testing.py. When pulling this and running this code I continuously get error
ModuleNotFoundError: No module named 'athenahealthapi'
I am unable to install athenahealthapi
If you are looking at the API code samples you should see one that has a class connection called APIConnection. I believe you need to save that code as a file named athenahealthapi.py in the same folder that you are running your script. That essentially is the athenahealthapi module and it pulls the APIConnection class as athenahealthapi.APIConnection(). I got past that part but am now having trouble with a missing access_token key error. :(
I'm new to django and I am trying to make an API call to ebay when a user clicks a button, using ebay python SDK. There is a YAML file inside my project which contains the api keys. In my app, I have a python file that contains a function that makes the api call. When I run the function that python file separately, it works fine and finds the YAML file no problem. But when I try to run that same function from views.py, it gives me an error that says - config file 'ebay.yaml' not found. Can anyone please help me with this as I have no idea what's wrong... Do I have to do anything special when running the API call through django, besides just having a YAML file in the same direcotry?
Your ebay.yaml file should be in the same directory as manage.py in order to work properly.
Here is an example:
folder/
ebay.yaml
manage.py
I am using AWS Lambda, Python 3.7 and SendGrid API and want to send an email but getting the error:
"Unable to import module 'lambda_function': No module named 'sendgrid'"
Is there a way to resolve this? I can see that in some similar issues that the module would be imported from somewhere but can't work out from where.
My lambda code is just the sample code from the SendGrid website which values updated with the ones I want to use:
import json
import sendgrid
import os
from sendgrid.helpers.mail import *
def lambda_handler(event, context):
sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
from_email = Email("test#example.com")
to_email = Email("****")
subject = "Sending with SendGrid is Fun"
content = Content("text/plain", "and easy to do anywhere, even with Python")
mail = Mail(from_email, subject, to_email, content)
response = sg.client.mail.send.post(request_body=mail.get())
print(response.status_code)
print(response.body)
print(response.headers)
Thanks
The lambda environment does not have the sendgrid module available for your code to call. In order to use dependencies that aren't apart of the aws sdk or the language (like the sendgrid library) you have to pre-build the code with the packages locally and upload a zip file. An example can be found here: aws python lambda . There is another stack overflow addressing the same question here. The second contains some tools to make uploading easier.
Whenever I try to retrieve data from firebase to my .ipynb. It gives me error that there is not such module like firebase_admin. When I installed that module to my conda environment. Again, It says that it is only available for Python2, but I want in Python3. Is there any way please answer:
from firebase import firebase #firebase data retrieving code #live
firebase = firebase.FirebaseApplication('LINK-TO-DATABASE', None)
result = firebase.get('/user', None)
result # type(result)=dict, JSON formate