Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pin function strips whitespace? #3

Closed
flygohr opened this issue Aug 31, 2019 · 10 comments
Closed

Pin function strips whitespace? #3

flygohr opened this issue Aug 31, 2019 · 10 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@flygohr
Copy link

flygohr commented Aug 31, 2019

Hi there! I am trying to work with your repository from a couple of days but I am having some trouble with the pin titles.

I am using bs4 to get the title of a webpage to use as the pin title. The variable displays correctly when printed, but as soon as I pass it to the pin function all of the white spaces are removed when I look at the board on Pinterest.

Any idea why is this happening? Can you look at my code and help me figure it out?

@bstoilov
Copy link
Owner

bstoilov commented Sep 2, 2019

Hello, I noticed this problem once or twice but eventually it went away, probably it is some corner case, can you give me the piece of code you are using to pin?

@flygohr
Copy link
Author

flygohr commented Sep 2, 2019

It actually did it on 500+ pins with no exception. The title-grabbing function is ok, tested multiple times.

It's strange it did it only once or twice on your end, as I noticed this on lines 10-18 of RequestBuilder.py:

def buildPost(self, options, source_url, context={}):
        return self.url_encode({
            'source_url': source_url,
            'data': json.dumps({
                'options': options,
                "context": context
            }).replace(' ', ''),
            '_': '%s' % int(time.time() * 1000)
        })

I changed the replace with a full whitespace. I just run the script on 1000+ pins and it worked without a single error, adding all the necessary spaces to ALL pins.

@bstoilov
Copy link
Owner

bstoilov commented Sep 2, 2019

Great! Nice catch, I haven't set up collaborators on the repo yet, so I will apply your fix and push the new version :)

@flygohr
Copy link
Author

flygohr commented Sep 2, 2019 via email

@bstoilov
Copy link
Owner

bstoilov commented Sep 2, 2019

I will test it on my end, there was some reason for this for sure.

@bstoilov bstoilov added bug Something isn't working enhancement New feature or request labels Sep 2, 2019
@flygohr
Copy link
Author

flygohr commented Sep 2, 2019 via email

@bstoilov
Copy link
Owner

bstoilov commented Sep 3, 2019

It appears that the whole replace was a left over from other issue. I have removed it entirely and all the f unctions are working as expected.

The new version 0.2.3 is published let me know if you still have the issue.

@flygohr
Copy link
Author

flygohr commented Sep 3, 2019 via email

@flygohr
Copy link
Author

flygohr commented Sep 4, 2019

Yep, it's working out of the box! Just tried the pin function tho, no need for others atm

@bstoilov
Copy link
Owner

bstoilov commented Sep 4, 2019

Great closing the issue

@bstoilov bstoilov closed this as completed Sep 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants