Có thư viện hoặc gói nào mà chúng tôi có thể sử dụng với python để kết nối với salesforce và lấy dữ liệu không?thư viện salesforce python để nhận dữ liệu salesforce?
9
A
Trả lời
15
tôi sử dụng beatbox
Ví dụ để truy vấn cho hàng tiềm năng bằng địa chỉ email
import beatbox
sf_username = "Username"
sf_password = "password"
sf_api_token = "api token"
def get_lead_records_by_email(email)
sf_client = beatbox.PythonClient()
password = str("%s%s" % (sf_password, sf_api_token))
sf_client.login(sf_username, password)
lead_qry = "SELECT id, Email, FirstName, LastName, OwnerId FROM Lead WHERE Email = '%s'" % (email)
records = sf_client.query(lead_qry)
return records
Để có được các dữ liệu khác nhìn vào xem salesforce api docs
ví dụ beatbox khác here
1
Cái này là trải nghiệm tốt nhất trong kinh nghiệm của tôi: http://code.google.com/p/salesforce-python-toolkit/
7
Ngoài ra còn có một gói gọi là simple_salesforce.
Bạn có thể cài đặt nó với:
$ pip install simple_salesforce
Bạn có thể truy cập vào tài khoản của Salesforce của bạn như sau:
from simple_salesforce import Salesforce
sf = Salesforce(username='[email protected]', password='password', security_token='token')
Các readme là hữu ích liên quan đến chi tiết ...
0
Mặc dù đây không phải là Python cụ thể. Tôi bắt gặp một công cụ tuyệt vời cho dòng lệnh. Bạn có thể chạy lệnh bash như một tùy chọn ..
Usage: force <command> [<args>]
Available commands:
login force login [-i=<instance>] [<-u=username> <-p=password>]
logout Log out from force.com
logins List force.com logins used
active Show or set the active force.com account
whoami Show information about the active account
describe Describe the object or list of available objects
sobject Manage standard & custom objects
bigobject Manage big objects
field Manage sobject fields
record Create, modify, or view records
bulk Load csv file use Bulk API
fetch Export specified artifact(s) to a local directory
import Import metadata from a local directory
export Export metadata to a local directory
query Execute a SOQL statement
apex Execute anonymous Apex code
trace Manage trace flags
log Fetch debug logs
eventlogfile List and fetch event log file
oauth Manage ConnectedApp credentials
test Run apex tests
security Displays the OLS and FLS for a give SObject
version Display current version
update Update to the latest version
push Deploy artifact from a local directory
aura force aura push -resourcepath=<filepath>
password See password status or reset password
notify Should notifications be used
limits Display current limits
help Show this help
datapipe Manage DataPipes
2
Đây là mã sẵn sàng để có được bất cứ ai bắt đầu. Để tìm nạp báo cáo từ SFDC.
import pandas as pd
import numpy as np
from pandas import DataFrame, Series
from simple_salesforce import Salesforce #imported salesforce
sf = Salesforce(username='[email protected]', password='enter_password', security_token = 'Salesforce_token')
mã thông báo salesforce được nhận trong email mỗi khi bạn thay đổi mật khẩu.
import requests #imported requests
session = requests.Session() #starting sessions
from io import StringIO #to read web data
error_report_defined = session.get("https://na4.salesforce.com/xxxxxxxxxxxx?export=1&enc=UTF-8&xf=csv".format('xxxxxxxxxxxx'), headers=sf.headers, cookies={'sid': sf.session_id})
df_sfdc_error_report_defined = pd.DataFrame.from_csv(StringIO(error_report_defined.text))
df_sfdc_error_report_defined = df_sfdc_error_report_defined.to_csv('defined.csv', encoding = 'utf-8')
error_report = pd.read_csv('defined.csv') #your report is saved in csv format
print (error_report)
Các vấn đề liên quan
- 1. Xác thực Id Salesforce
- 2. Đăng nhập SalesForce trên iOS mà không cần sử dụng SalesForce Webview?
- 3. Salesforce SOQL mô tả bảng
- 4. Đăng nhập API REST Salesforce?
- 5. Quay lại các thay đổi trong Salesforce
- 6. LINQ to Salesforce "SQL" nhà cung cấp
- 7. Truy vấn API REST Salesforce Hơn 2000
- 8. Xây dựng các ứng dụng kiểu OLAP với SalesForce/Apex
- 9. Làm cách nào để tích hợp Salesforce với Google Maps?
- 10. Làm cách nào để sao lưu gói SalesForce?
- 11. Không refresh_token trong Phản hồi OAuth của SalesForce
- 12. Truy xuất giới hạn yêu cầu Api Salesforce hàng ngày
- 13. Phân tích đối tượng JSON trong Salesforce Apex
- 14. Cập nhật salesforce wsdl động bằng C# code
- 15. Cập nhật không hoạt động trong SalesForce API
- 16. Salesforce SOQL: truy vấn để lấy tất cả các trường trên thực thể
- 17. Thư viện mạng Node.js: nhận dữ liệu hoàn chỉnh từ sự kiện 'dữ liệu'
- 18. Salesforce Tạo tùy chọn Nút và Liên kết - URL tùy chỉnh để khởi chạy mẫu email
- 19. Thư viện quản lý dữ liệu IPTC
- 20. ở đâu để có được client_id và client_secret của Salesforce API cho Rails 3.2.11
- 21. Thư viện cấu trúc dữ liệu C
- 22. Salesforce - SOQL Sử dụng mod() hoặc các hàm toán học tương tự trong SELECT?
- 23. liên hệ với tài khoản bằng cách sử dụng Salesforce api
- 24. Thư viện JS để vệ sinh dữ liệu nhận được từ người dùng?
- 25. Thư viện Java để tạo dữ liệu TomTom GPS poi
- 26. Thư viện C++ để đọc mã ma trận dữ liệu
- 27. Thư viện để chuyển đổi samplerate dữ liệu âm thanh?
- 28. Thư viện java nguồn mở để đọc dữ liệu ECG?
- 29. Azure ACS có hỗ trợ IdP 2.0 saml như Salesforce không?
- 30. Cách thêm đệm vào dữ liệu để có thể chấp nhận thuật toán mã hóa AES256 trong thư viện pycrypto
hey matto, tôi đã thấy nội dung tải xuống của họ, nó chỉ dành cho Windows? không có gói cho linux/mac? – daydreamer
nếu bạn đã cài đặt setuptools, bạn có thể làm 'easy_install beatbox', nếu không tải xuống gói từ github https://github.com/superfell/Beatbox và chạy' python setup.py install' – MattoTodd
tuyệt vời, sẽ thử – daydreamer