i want to publish an update on bufferapp.com with python.
I installed the python buffer modul: https://github.com/bufferapp/buffer-python
I managed to connect to their api with python3.
But if i use the update.publish() command it gives me the following error:
nameerror: "update" is not defined.
Im using this code:
from pprint import pprint as pp
from colorama import Fore
from buffpy.models.update import Update
from buffpy.managers.profiles import Profiles
from buffpy.managers.updates import Updates
from buffpy.api import API
token = 'awesome_token'
api = API(client_id='client_id',
client_secret='client_secret',
access_token=token)
# publish now
update.publish()
What am i doing wrong?
Thank you for your help.
Related
import streamlit as st
import pandas as pd
import numpy as np
import requests
import tweepy
import config
import psycopg2
import psycopg2.extras
import plotly.graph_objects as go
auth = tweepy.OAuthHandler(config.TWITTER_CONSUMER_KEY,
config.TWITTER_CONSUMER_SECRET)
auth.set_access_token(config.TWITTER_ACCESS_TOKEN,
config.TWITTER_ACCESS_TOKEN_SECRET)
api = tweepy.API(auth)
Problem with my code, it is not running with the twitter key. The module has no attributes
The config module that you are attempting to import and read off of is not what you want.
TWITTER_CONSUMER_KEY and TWITTER_CONSUMER_SECRET are not constants that you can get from a module. These are values that you must input yourself. There is perhaps a piece of code missing at the start of your application that looks like this:
config = {
'TWITTER_CONSUMER_KEY': 'ENTER YOUR TWITTER CONSUMER KEY',
'TWITTER_CONSUMER_SECRET': 'ENTER YOUR TWITTER CONSUMER SECRET'
}
Take a look at this article for more help. Goodluck!
I have been working on a FedEx tracking API program in Python. I have what I think to be the right code and I have already registered and gained access through FedEx to use the API keys and so on. I am having difficulty finding what packages/libraries to install and then import to be able to run my program. Here is what I have.
from fedex.config import FedexConfig
CONFIG_OBJ = FedexConfig(key='<key>',
password='<pass>',
account_number='<acct_no>',
meter_number='<meter_no>')
from fedex.services.track_service import FedexTrackRequest
track = FedexTrackRequest(CONFIG_OBJ)
tracking_num = '781820562774'
track.SelectionDetails.PackageIdentifier.Type =
'TRACKING_NUMBER_OR_DOORTAG'
track.SelectionDetails.PackageIdentifier.Value = tracking_num
track.SelectionDetails.PackageIdentifier.CarrierCode = 'FDXG' #G
for ground FDXE for express
track.send_request()
print(track.response)
to use API's you should use the requests and json libraries
if you don't have the requests library, simply use pip install requests
here's a simple example:
import requests
import json
fedex = requests.get ("URL")
fedex_api = fedex.json()
I am trying to connect to FXCM throuhg an api and am constantly getting an error:
|ERROR|2020-01-11 20:42:41,825|Socket returns an error: ('Connection aborted.', OSError("(10054, 'WSAECONNRESET')")).
The code is :
import fxcmpy
import pandas as pd
from pandas import datetime
from pandas import DataFrame as df
import matplotlib
from pandas_datareader import data as web
import matplotlib.pyplot as plt
import datetime
from datetime import date
import numpy as np
TOKEN = "hidden"
con = fxcmpy.fxcmpy(access_token=TOKEN, log_level='error')
I have been using this for a while now but error suddenly showed up today. How can i fix this?
I got the same problem. I got an email from api#fxcm.com below.
"We did a release on demo on 1/12 to improve the Rest API.
With that said, Our REST API wrapper fxcmpy has been updated, you need to install the latest fxcmpy version at 1.2.6.
Here is the link where you can find the library: https://pypi.org/project/fxcmpy/#files
Please have in mind that just with pip install fxcmpy it might not work as it won’t update the library, please use below command."
pip install –U fxcmpy
Hello I've followed these steps:
on my code folder
pip install recurly
Create code:
import recurly
from recurly import Account
recurly.SUBDOMAIN = 'mi-domain'
recurly.API_KEY = 'abdcdddd1d7445fba86b5ca35eef00d5'
recurly.DEFAULT_CURRENCY = 'USD'
account = Account.get('id45')
account.delete()
and when I try to execute code above
I get
ImportError: cannot import name Account
Why is it that imports recurly with no problem but cannot import resources?
You'll have to call recurly.Account.get('id45') to get the account you'd like. You can find an example with correct syntax here: https://github.com/recurly/recurly-js-examples/blob/master/api/python/app.py#L70
I'm looking through some of the user documentation for github3.py library.
I'm trying to list all of a user's repos.
If I use the code below, with gr = gh.repos.list().all(), I get the expected results.
But, if I use gr = gh.repos.list(user='username',type='all'), I get this error: <pygithub3.core.result.smart.Result object at 0x00000000033728D0>
Looking at the docs, this should work, but I'm new to Python and this library so I may be missing something??
#!/usr/bin/env python
from pygithub3 import Github
import requests
auth = dict(login="xxxx", user = "xxxx", token="xxxxx", repo="my-repo")
gh = Github(**auth)
gr = gh.repos.list().all()
print gr
Try this way:
from pygithub3 import Github
auth = dict(login="my-github-login", password="my-github-password")
g = Github(**auth)
print g.repos.list(user='user-whose-repos-I-want-to-get').all()