• Himanshu Patel 46
  • NEWBIE
  • 10 Points
  • Member since 2017
  • Salesforce Developer


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
Hi All, 

I am bit confused with mentioned best practices in relation to Sandbox refresh. Somewhere I read that sanbox refresh should be done everyday.

Still I can't my get around of whole sandbox refresh concept. Why we even need that?

I thought in small development with one or two developer, each person will get a sandbox on requirement gathering. Finally, the requirements are fullfilled and code should be merged in integration enviornment, which will eventually moved to UAT and development box.
In this whole process why we need to refresh the sandboxes? The Integration environment will always be a copy of Production unless you make the urgent changes, directly, on production. 

In larger team, I guess other developers might need the recent changes which are just applied by someone on development box. However it doesn't mean other developers changes also will wipe out and need to recreate everything?


 
Hi,
I am trying to read the body of attachment and writing in a text file using Python. Below is the sample code. 
import urllib
import requests
import base64
import json
from simple_salesforce import Salesforce
import urllib.request as urllib



instance = ''

sf = Salesforce(username='username', password='password', security_token='security_token')
sessionId = sf.session_id

attachment = sf.query("SELECT id, name,Body FROM Attachment where parentID =''")
body = ""

req = urllib.Request('https://%s.salesforce.com/services/data/v38.0/sobjects/Attachment/<id>/Body/' % instance,
    headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer %s' % sessionId })
f = urllib.urlopen(req)
f1 = open("demofile.txt", "wb")
for x in f:
    f1.write(x)
f.close()
f1.close()
But, I am getting below error.
f1.write(x)
TypeError: write() argument must be str, not bytes
Please correct me, if something is wrong.

Thanks and Regards,
Diwakar G