pyokc 0.3

pyokc

Use

First things first

Go to settings.py and assign your OKCupid profile name to `USERNAME` and your passwordto `PASSWORD`. From now on you won't need to enter either for any pyokc scripts.

Starting a new session

```pythonfrom pyokc import pyokc

u = pyokc.User()```

Messaging another user

```pythonu.message('foxylady899', 'Do you have a map?')```

Searching profiles

```pythonprofile_list = u.search(age_min=26, age_max=32)```

Just like OKCupid, pyokc uses default search values if you haven't specified aparticular value. For instance, if you do not state a search location orradius, the profiles returned will be within a 25-mile radius of your profile'slocation. By default, `search` returns 18 profiles, however this can be changedwith the `number` keyword parameter. You can search using every metric thatOKCupid currently allows, with the exception of A-list only options. Theobjects returned in the list are Profile objects that contain basic informationabout a profile as attributes such as `name`, `age`, and `match`. The actualcontent of a profile, however, cannot be accessed without actually visiting theprofile.

Visiting a profile

`u.visit('foxylady899')` or `u.visit(profile_list[0])`The argument passed to `visit` can either be a string username or a Profileobject. Note that this will cause you to show up in that user's visitors list,unless you've turned on invisible browsing. Once you have visited a profile, youshould have access to just about every piece of information that is alsoavailable on the website. You can check out the docstrings and source code ofthe Profile class in pyokc.py to get a better idea of what is available to you.

Rating a profile

```pythonu.rate('foxylady899', 5)```

User/Profile questions

The questions that you or someone else have answered can be accessed as alist via the `questions` attribute of `User` or `Profile`, respectively.Because getting this information can involve a time-consuming number ofrequests, you must first manually fill this list via the`User.update_questions()` or `Profile.update_questions()` methods. Youcan then access Question information via attributes like `q.text` and`q.user_answer`.

Mailbox

```pythonfirst_thread = u.inbox[0]

u.read(first_thread)

print(first_thread.messages)```

Because reading each thread requires a request to the server, you mustfirst pass a MessageThread object as an argument to `User.read()` beforeits `messages` attribute will become available.

Installation

```bashpip install pyokc```

pyokc has two dependencies: requests and lxml.

Note: Windows users will likely run into issues installing lxml. Ifthis happens, be sure to install the binarieshere and then usepip again.

FAQ

Why is my program going slowly?

pyokc overrides the `get` and `post` methods of Requests.Session to include a3-second delay between requests to OKCupid. Hopefully, this will preventsomeone from making too many requests in too short of a timespan and bringingdown the wrath of the OKCupid powers-that-be. This length of time can bemodified by changing the number assigned to `DELAY` in settings.py.

Why is x/y/z giving me an error message?

OKCupid updates its site frequently, and it can be difficult to keep up. If you run into an error, feel free to create an issue or send a pull request, and I'll get to it as quickly as possible.